0

I am developing an application with list-view, which consists of check box as well as Rating bar, here my problem is while i am clicking on arrow button or on listview on item click listener is not working for me? any one can help me i am trying for longtime........

enter image description here

ListView lv = getListView(); 
lv.setOnItemClickListener(new OnItemClickListener() 
{ 
 @Override 
 public void onItemClick(AdapterView<?> arg0, View arg1,int position, long arg3) 
  { 
  Toast.makeText(SuggestionActivity.this, "" + position, Toast.LENGTH_SHORT).show(); 
  } 
  }); 
  } 
RajaReddy PolamReddy
  • 22,428
  • 19
  • 115
  • 166
NikhilReddy
  • 6,904
  • 11
  • 38
  • 58
  • 1
    Would help if we had some code to look at. – dotty Oct 11 '11 at 11:37
  • ListView lv = getListView(); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView> arg0, View arg1,int position, long arg3) { Toast.makeText(SuggestionActivity.this, "" + position, Toast.LENGTH_SHORT).show(); } }); } – NikhilReddy Oct 11 '11 at 11:39
  • this is the code which i have used.. i have extended list activity. – NikhilReddy Oct 11 '11 at 11:39
  • http://stackoverflow.com/questions/7635891/onitemclicklistner-is-not-working-android http://stackoverflow.com/questions/7645880/list-view-with-on-item-click-listener-android ... there are answers ... YOU HAVE FOCUSABLE ELEMENT IN LISTVIEW ROW (Button, Rating Bar, Checkbox) – Selvin Oct 11 '11 at 12:17
  • try to set click able property as lv.setClickable(true) before setonclicklistener. – Pankaj Kumar Oct 11 '11 at 13:06

2 Answers2

0

This is because of your layout items. Try to disable the clickability of them using these:

 android:focusable="false"
    android:focusableInTouchMode="false"
jyomin
  • 1,957
  • 2
  • 11
  • 27
0

use this

ListView lv = getListView();

lv.setOnItemClickListener(new OnItemClickListener() {
   public void onItemClick(AdapterView<?> parent, View v,int position, long id) {

   });
}
RajaReddy PolamReddy
  • 22,428
  • 19
  • 115
  • 166