deepthi
deepthi

Reputation: 8487

how to update the spinner values while clicking on button in android?

my app have a spinner and also have reset button. how to update the values while clicking on button?

Upvotes: 3

Views: 3977

Answers (2)

Kapil D
Kapil D

Reputation: 2660

Change the underlying data and call the notifyDataSetChanged() on adapter.

          list.clear();
          list.add("A");
              list.add("B");
          dataAdapter.notifyDataSetChanged();

Upvotes: 0

CommonsWare
CommonsWare

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

Related Questions