1
在我們的一項活動中,我們在FrameLayout中有四個ListView。我們 在這個Framelayout中也有一個共同的WebView設置爲EmptyView,用於 這些列表中的每一個。 該TextView的內容應該根據不同的上下文在運行時 更改。動態設置空視圖:安全嗎?
結果,我們稱之爲:
1. mEmptyView.loadData(...),然後
2. mListOne.setEmptyView(mEmptyView)調用。
這在大多數情況下都能正常工作。但有時我們正在獲取, 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(2131362332, class
android.widget.ListView) with Adapter(class my.own.activity.MainAct
$UIAdapter)]
at android.widget.ListView.layoutChildren(ListView.java:1492)
at android.widget.AbsListView.onLayout(AbsListView.java:1147)
at android.widget.AdapterView.updateEmptyStatus(AdapterView.java:724)
at android.widget.AdapterView.setEmptyView(AdapterView.java:637)
問題:它是安全的改變空視圖的內容,並呼籲 的ListView#setEmptyView在運行時?
不,我沒有。我只是添加純文本視圖 – Samuh 2011-02-28 09:26:36