0

Any idea how to automatically fire onItemClick :

public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3)

under the setOnItemClickListener of a ListView :

listView.setOnItemClickListener(new OnItemClickListener()

without user interference.

ahmed_khan_89
  • 2,755
  • 26
  • 49
  • clear your question first. – M D May 14 '14 at 08:46
  • have you try `Mylistview.setItemChecked(position, true);`? – Shayan Pourvatan May 14 '14 at 08:47
  • see http://stackoverflow.com/questions/9820175/android-how-to-tap-listview-item-programmatically and http://stackoverflow.com/questions/10788688/programmatically-select-item-listview – Shayan Pourvatan May 14 '14 at 08:49
  • try this way `list.performItemClick(list.getChildAt(0),0,list.getAdapter().getItemId(0));` – M D May 14 '14 at 08:56
  • I have created Activity extends FragmentActivity and under "onCreate(Bundle savedInstanceState)" called custom adaptor to bind the listview. and setOnItemClickListener on listview. normally working fine if user click on list item but I want to execute automatically so i hide the intermediate listview (this). – user2717440 May 14 '14 at 09:00
  • @user2717440 why do you need such a requirement. Its UI and you should leave it to the user to decide to click or not click. – Raghunandan May 14 '14 at 09:01
  • don't want to show this listview to user but task should be performed on the basis of this listview. – user2717440 May 14 '14 at 09:03
  • If the requirement is to hide the listview, why don't you just set its visibility to gone? – nasch May 18 '14 at 05:02

0 Answers0