I have programmed a ListView with some elements. Now I want to know which element was clicked. So that I can say, when the first was clicked, do this, the second, do that.
So how do I know which element the user clicked?
Thanks
I have programmed a ListView with some elements. Now I want to know which element was clicked. So that I can say, when the first was clicked, do this, the second, do that.
So how do I know which element the user clicked?
Thanks
I have done it with the position of the element.
Try setOnItemClickListener
. This is a pretty basic question. Google is your friend. :-)
Use list.setOnListItemClickListener
and use the index
or position
parameter that the listener passes :)