Reputation: 2609
I have a ListView
with a custom adapter that only has a TextView
, and I want to set a click listener for it.
Which one I should choose: ListView.setOnItemClickListener
outside of the custom adapter, or TextView.setOnClickListener
inside the custom adapter's getView()
? And why?
Thanks!
L.
Upvotes: 0
Views: 526
Reputation: 589
adding onClickListener to views in the getView() method is using when you have 2 or more views that should have their own onClickListener,so for your is better onItemClickListener
Upvotes: 1
Reputation: 2311
You should definitely use ListView.setOnItemClickListener
Upvotes: 5