Android - How to tap ListView item programmatically

cool dev picture cool dev · Mar 22, 2012 · Viewed 25.4k times · Source

How to call ItemClickListener programmatically? listView.performItemClick() does not work. Is that possible?

Answer

Arun Jose picture Arun Jose · Apr 29, 2013
mList.performItemClick(
    mList.getAdapter().getView(mActivePosition, null, null),
    mActivePosition,
    mList.getAdapter().getItemId(mActivePosition));

Where mActivePosition is your click position!