Skip to content Skip to sidebar Skip to footer

Android: Listview's Onitemclick() Event Not Getting Called

Following is my code : public class TestActivity extends ListActivity { private Cursor cursor; /** Called when the activity is first created. */ @Override public

Solution 1:

I was having a similar problem and found that after removing android:clickable="true" from my list items, the onListItemClick() was being triggered just fine. I hope this helps.

Solution 2:

protectedvoidonListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    StringmString= parent.getItemAtPosition(position).toString();
    //will give you the text of current line orinti= parent.getItemAtPosition(position);
    //if you want just position number
}

Solution 3:

The solution is to override protected void onListItemClick (ListView l, View v, int position, long id) method.

Solution 4:

I had this problem also. I solved it by Removing this from my TextView in the the layout XML.

    android:textIsSelectable="true"

Post a Comment for "Android: Listview's Onitemclick() Event Not Getting Called"