Reputation: 15882
I am creating lists in my android app and would like to capture the text of the list item that is clicked but I want to do it in a seperate function so I only have to write the code once. And I want to be able to compare the string to another sting.
What is the best way to do this?
Upvotes: 0
Views: 3851
Reputation: 68444
You need OnItemClickListener() set to your list and overwrite
onItemClick(AdapterView<?> parent, View view, int position, long id)
then get you text either from item itself or from the view.
Upvotes: 1