我们的一项活动在FrameLayout中有四个ListView。我们 在此Framelayout中也有一个常见的WebView设置为EmptyView for 这些清单中的每一个。 此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在运行时?
答案 0 :(得分:0)
只有一个想法......您是否尝试过使用ViewGroup及其addView方法? RelativeLayout是一个视图组