Event Click On Listview (extends Listactivity)
i have this code but i can't see the action when i click on a item from the list. This code shows me the info on ArrayList profilesArrayList but i dont know how i check what item i
Solution 1:
If your container class for this code is the ListActivity, just override the onListItemClick for that class, rather than set it as an OnItemClickListener for the view. That works for me
publicclassProfileListextendsListActivity
{
private ArrayList<Profile> profilesArrayList;
@OverridepublicvoidonCreate( Bundle savedInstanceState )
{
super.onCreate(savedInstanceState);
//populate your arraylist
setListAdapter ( newArrayAdapter<Profile>() );
}
@OverrideprotectedvoidonListItemClick(ListView l, View v, int position, long id)
{
super.onListItemClick(l, v, position, id);
Log.d("cardNumber", profilesArrayList.get(position).getCardNumber());
}
}
Solution 2:
Try to use getSelectedItemPosition() and add INVALID_POSITION as one of your possible cases
Post a Comment for "Event Click On Listview (extends Listactivity)"