PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged

今天开发的时候遇到了如题的异常。上网搜到了个答案:ide

After ADT 22 the PagerAdapter has gotten very strict about calling notifyDataSetChanged() before calling getCount().  It evidently keeps track of what it thinks the count should be and if this is not the same as what getCount() returns it throws this exception.  So the solution is simply to call notifyDataSetChanged() on the adapter every time the size of the data changes.this

解决办法就是必需要在对adapter的data作改变以后立刻调用notifyDataSetChanged()。搜索了代码,确实发现有没有调用的地方。改了就行了。开发

相关文章
相关标签/搜索