I've a Spinner with onItemSelected interation that works, but how the Api specification says:
This callback is invoked only when the newly selected position is different from the
previously selected position or if there was no selected item.
I need to remove this limitation and i want that the callback is invoked also if the user select the same element. How to do that?
Anyone did the same thing?
Any idea about this would be appreciable..
Find the oldselected position in spinner and make it accesible and set it to -1 means internally its changing the selected position but user can't see. So when user selects same position as previously selected position in the spinner, it will get select without fail.
Let the Spinner's first value be something like "-please select-". when the user clicks on the next button perform validation and check whether the value of the selectedItem in the spinner is "-please select-" and if yes, then display a toast and ask the the user to select something from the spinner.
getItemAtPosition(i).
i want that the callback is invoked also if the user select the same element. How to do that?
Setting the OnItemClickListener
for a Spinner will throw an exception and using ItemSelectedListener
you will not be notified if the user click on the selected/same element.
I suppose the only way to overcome this limitation is to use a CustomAdapter for the Spinner items and implement the setOnClickListener
for each view in the adapter.
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