How to perform autoclick of List Items in listview Android

橙三吉。 提交于 2019-12-25 05:29:10

问题


I had a scenario where I need to handle the clicks of each list item one by one with out clicking on that item. Is there a possiblity in which I can achieve this scenario. Can anyone help me is sorting out this issue.

Thanks in Advance


回答1:


mList.performItemClick(
        myList.getAdapter().getView(position,null,null),position,myList.getAdapter().getItemId(position));

here position is your click position

or simply you can do this

mList.getAdapter().getView(position, null, null).performClick();



回答2:


You can retrieve your list item and call item.perFormClick()



来源:https://stackoverflow.com/questions/19274013/how-to-perform-autoclick-of-list-items-in-listview-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!