I have a list view that is built using a simpleAdapter, each row is defined by a Layout containing a TableRow and a few TextView.
What should I do to know on which TextView (in the layout) was clicked on?
I am able to get the listview row (position) if I use a OnItemClickListener on the Listview, however it dosen't tell me on which TextView on that row was clicked on.
I would like to take different action depending on which TextView a user click on in a listview
listview
-----------------------
TextView1 : TextView2 | <--Row1
-----------------------
TextView1 : TextView2 | <--Row2
-----------------------
TextView1 | TextView2 | <--Row3
-----------------------
I would like to be able to tell, that row 2's TextView2 was click on.
Hopefully I am explaining myself well enough.
Thanks you
If the click is being handled by
onItemClick
, then you cannot know from this whichView
WITHIN thatView
was clicked. AnOnItemClickListener
just handles clicking a list item. What you might try is using a customadapter
in which you grab hold of all the Views in the row ingetView()
and setonClickListeners
on them there. Or you can define theonClickListeners
directly in yourView
class if possible.