How do I get all items in a Spinner?
I was having trouble trying to search a way to get all items from a Spinner
but I was not able to find an elegant solution. The only solution seems to be storing the items list before to add it to the Spinner
Is there another better way to do this?
A simple and elegant way to do this is, if you know the objects type that the spinner is storing:
Given the previous class and a
Spinner
that contains a list ofUser
you can do the following:This helped me! I hope it would do it for you!