2011-04-27 73 views
0

嗨,我有一個線程,從服務器運行和檢索旋轉器的值,直到那麼旋轉器是空的我怎麼能更新微調器的值,當我得到的價值.. ..我的活動是在那個時候打開。活動打開時更新微調值?

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); 

回答

2

呼叫notifyDataSetChanged()上用於填充SpinnerAdapter

+0

[email protected] m geting以下錯誤 – Harinder 2011-04-27 09:43:58

+0

@i嘗試像這樣chk我更新的問題 – Harinder 2011-04-27 09:52:23