OLD QUESTION (Already answered by Mark - The answer is to use getTag()):
Let's say I have a ListView with a custom layout for each row having an ImageView and a TextView. Now, when a click is made, I am able to determine which image and which textview were clicked based on the view but if I have to pass this information to say another activity, I need the position. But, how would I get the position of the item clicked in the listview?
REVISED QUESTION:
I am doing the following: Custom ListView with an ImageView and a TextView. I would like to perform different actions depending on whether an image or a text element was clicked. Now, there are two approaches I can take to perform event handling:
Approach #1: Attach an OnItemClick Listener to an item in the ListView and perform a suitable action. Problem: It remains in question as to which element (image or text) was clicked. How would I determine this piece of information and then take the necessary action?
Approach #2: Attach an OnClick Listener to the image and text separately inside each listview item and then perform a suitable action. Problem: I am highly skeptical about the performance of this approach. Added to that, when a click is performed, the row of the item is not being highlighted which makes it highly non-intuitive. How would I make the row highlight in this case?
Any suggestions?