Reputation: 28198
I wrote a ListView to select a single item from a list. To achieve what I feel is a better separation of concerns in my ListView implementation, I am setting the onClickListener on each row's item view. Is there any functional difference between doing this and using the ListView's onItemClick?
I'm not terribly familiar with non-touchscreen android device interfaces and after watching the Google ListView video, am wondering if my technique may malfunction on other devices.
Is there any reason not to register onClick on each item's view?
Upvotes: 0
Views: 313
Reputation: 1719
The benefit you get from onItemClick is the paramters passed through function call specially position as a parameter. On OnClick its hard to determine which row has been clicked.
And onClick need to be registered with each row (view/layout) of ListView, while onItemClick need to be registered only once by calling setOnItemClickListener on ListView object.
Upvotes: 1