There is a ListView that works by clicking

 @Override public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3) { //алгоритм } 

It’s a long time to explain why, but how to invoke push processing from the constructor. (Explicit call)

  • one
    Do you need a program emulation of clicking on a list item? And from which constructor do you want to call this click handling? Try to ask the question so that it is understandable not only to you, but also to others. This will greatly increase your chances of getting the right answer. - pavlofff

2 answers 2

As I understand the condition, you need to use the following ListView method:

public boolean performItemClick (View view, int position, long id)

Call example:

 mList.performItemClick( mList.getAdapter().getView(mActivePosition, null, null), mActivePosition, mList.getAdapter().getItemId(mActivePosition)); 

This method emits a click on an element in the position mActivePosition .

    Create an OnItemClickListener object, for example:

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

    Well, where you need:

     list.setOnItemClickListener(listener); 

    PS: Google to help