欢迎来到 Android人的问与答 ,在这里提问或帮助他人解答。 Question2Answer的1.6.x和1.7.x版本的中文翻译包我修改更新:

Question2answer

如何使用中文语言包

Q2A 1.6.x - Chinese Simplified (简体中文)

Q2A 1.7.x - Chinese Simplified (简体中文)


国内服务器推荐 阿里云服务器
国外服务器推荐 DigitalOcean
VPN推荐 正版Green VPN
阿里云推荐码:ldvq50

ListView相关的java.lang.IllegalStateException

0 喜欢 0 不喜欢
201 浏览
一般情况下,Adapter性质的类,只要Adapter中的数据更新后没有及时调用notifyDataSetChanged() 。或者在异步工作线程中修改数据。可能就会触发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.      
Make sure your adapter calls notifyDataSetChanged() when its content changes. 
[in ListView(2131558482, class android.widget.ListView) with Adapter(
class android.widget.HeaderViewListAdapter)]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. Make sure your adapter calls notifyDataSetChanged() when 
its content changes. [in ListView(2131558482, class android.widget.ListView) 
with Adapter(class android.widget.HeaderViewListAdapter)]  
 
解决方法:就是在修改Adapter数据的时候,紧跟着调用notifyDataSetChanged() 。
最新提问 5月 13, 2016 分类:Android View | 用户: forlong401 (7,050 分)

登录 或者 注册 后回答这个问题。

...