Skip to content Skip to sidebar Skip to footer

Refresh Spinner Data

I have an application with a Spinner whos data is populated by a cursor from the database. Works great if there is something in the database table on startup. However, if I add s

Solution 1:

Just change the underlying data and call notifyDataSetChanged()

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

Solution 2:

Ok, I got it figured out. I needed to close the adapter, stop managing the cursor, close the cursor & close the db helper in the onSuspend() method then set everything back up in the onResume method since I was using a seperate activity to add records to the table.


Post a Comment for "Refresh Spinner Data"