prom85
prom85

Reputation: 17818

android spinner - how do I remove the current selection?

I have some dependencies between my spinners and it happens, that a spinner becomes empty.

The problem now is, that I don't know how to clear the spinner, I'm adopting the data of the adapter, notify the adapter and if I click the spinner, there are no values in there, but the spinner's selected item is NOT cleared and still is displayed...

Upvotes: 1

Views: 4357

Answers (1)

Victor Laerte
Victor Laerte

Reputation: 6556

I'm not sure what you want, but to delete all itens in your spinner you can set the adapter null, like this:

mySpinner.setAdapter(null);

and if you want to remove a specific item, then you should remove it from your adapter and set your spinner again

mySpinner.setAdapter(myAdapter);

Upvotes: 3

Related Questions