Reputation: 11944
Hii i have a thread that runs and retrieve values for the spinnner from the server till then the spinnner is empty how can i update the values of the spinner when i get the values ..and my activity is open at that time.
ArrayList valforspinner=new ArrayList();
new Thread(new Runnable() {
public void run() {
valforspinner= GetList.List(myPrefs.getString("IP", ""));
adapter.notifyDataSetChanged();
}}).start();
spinner = (Spinner) findViewById(R.id.Spinner01);
adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, Printers);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
Upvotes: 0
Views: 441
Reputation: 39604
Call notifyDataSetChanged()
on the Adapter
used to fill the Spinner
.
Upvotes: 2