我用三個tabs.when我單擊該選項卡,顯示多個列表視圖與header.For,我使用listadapter 活動開始,我的代碼似乎adapter.addsection ("Header String",new ArrayAdapter(this,R.layout.row,cursor,from,to);
然後我用 list.setadapter設置列表(適配器) 。當我點擊標籤時,所有工作正常。我發生問題後,我滾動我的列表查看這是在另一個活動和 按模擬器返回按鈕,並單擊tab.Now當我點擊標籤,我的應用程序崩潰,logcat顯示以下錯誤。android中的java.lang.IllegalStateException?
java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(-1, class android.widget.ListView) with Adapter(class com.t.s.SeperatedListAdapter)]
這是什麼解決方案?我用adapter.notifydatasetchanged()來解決這個問題。但是我不能。
檢查來自鏈路的下列答案[計算器] [1] [計算器] [2] [計算器] [3] [1]:http://stackoverflow.com/questions/3132021/ android-listview-illegalstateexception-the-adapter-the-adapter-has-changed [2]:http://stackoverflow.com/questions/6478649/listview-illegalstateexception-the-content-of-the-adapter -has-changed-but-list [3]:http://stackoverflow.com/questions/4290806/how-to-solve-this-issuethe-content-of-the-adapter-has-changed-but- listview-did – user1203673 2012-02-23 09:45:23