I am doing a listView on android to display the list of all collection points, each with area and address, then user can click to each item and delete/edit it. ListView is populated by an array adapter with class Collection point.
When I try to set the action for user to click on a specific item on listview, I found there are some options: setOnItemSelectedListener vs setOnItemClickListener and setOnClickListener what is the differences between those, and which situation we should use each ? P/s: can you also explain the difference between onClick and onLongClick Thank you !
onClick
is used to invoke a specific operation when we simply click on the listview item where asonLongClick
is used when we click on the list item for long time(hold the item more than 1 sec and release.setOnItemClickListener
is used when the item is clicked (single selection) vssetOnItemSelectedListener
for the item is selected (used in multiple selection)setOnClickListener
is used to clicking event for button, txtview, imgview..