开发者

Multiple ListViews and onClick problem by finding out which ListViews is clicked

开发者 https://www.devze.com 2023-01-24 02:18 出处:网络
i am not very familiar with android coding so try to help me on a easy way. The problem开发者_如何学Go:

i am not very familiar with android coding so try to help me on a easy way.

The problem开发者_如何学Go: I have 2 Listviews and a onClick event handler. How can i find out on which listview the user currently clicked?

public void onListItemClick(ListView l, View v, int position, long id) {
'Approach: if listview1 is clicked then FUNCTION1() else FUNCTION2()'}

thx!


The first parameter to onListItemClick() is the ListView.

Also, since only one ListView will be handled by ListActivity (and therefore routed to onListItemClick()), your other ListView will have a dedicated OnItemClickListener.

0

精彩评论

暂无评论...
验证码 换一张
取 消