What is the difference between these two listeners,documentation says :
OnItemSelectedListener - Interface definition for a callback to be invoked when an item in this view has been selected.
OnItemClickListener - Interface definition for a callback to be invoked when an item in this AdapterView has been clicked.
Selection,Click aren't these equal on touch screen?
public abstract void onItemSelected (AdapterView<?> parent, View view, int position, long id) Callback method to be invoked when an item in this view has been selected. This callback is invoked only when the newly selected position is different from the previously selected position or if there was no selected item.
OnItemSelectedListener is used for Spinners, and OnItemClickListener is used for ListViews.
AdapterView.OnItemSelectedListener is invoked only when the newly selected position is different from the previously selected position or if there was no selected item.
However AdapterView.OnClickListener is invoked even you click the same item everytime.
http://developer.android.com/reference/android/widget/AdapterView.OnItemSelectedListener.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With