Reputation: 8487
my app have a spinner and also have reset button. how to update the values while clicking on button?
Upvotes: 3
Views: 3977
Reputation: 2660
Change the underlying data and call the notifyDataSetChanged() on adapter.
list.clear();
list.add("A");
list.add("B");
dataAdapter.notifyDataSetChanged();
Upvotes: 0
Reputation: 1006664
Set a new adapter on the Spinner
via setAdapter()
. Or, if it is an ArrayAdapter
, use add()
, insert()
, and remove()
to modify the data. Or, if it is a CursorAdapter
, requery()
it to get fresh data.
Since you elected not to tell us what "update the values" means, we can only guess.
Upvotes: 10