Pergunta

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?

Foi útil?

Solução

OnItemSelectedListener is used for Spinners, and OnItemClickListener is used for ListViews.

Outras dicas

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top