Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

simulate a click from onitemclick

Tags:

android

I already have an onitemclickListener and it works,

list.setOnItemClickListener( new OnItemClickListener()
{
     public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3){
         ...
     }
});

however, I need to implement the same functionality from a different button.

How do I reference the onitemclickListener that already exists for my list ?

I don't want to copy all the code and use it again as it is about 500 lines.

like image 659
Janpan Avatar asked Jan 29 '13 08:01

Janpan


Video Answer


1 Answers

There is performItemClick which does this.

list.performItemClick(list.getChildAt(pos), pos, list.getItemIdAtPosition(pos));
like image 182
lapis Avatar answered Sep 30 '22 19:09

lapis