refresh android spinner

If you change the underlying “back” list for the spinner, the spinner does not refresh automatically.
What we can do is :

  ....some change to you backing list 
  BaseAdapter adapter = (BaseAdapter) yourSpinner.getAdapter();
  adapter.notifyDataSetChanged();

The notifyDataSetChanged() will force refresh the spinner so that the list change can be applied to the view.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s