今天開發的時候遇到了如題的異常。上網搜到了個答案: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()。搜索了代碼,確實發現有沒有調用的地方。改了就行了。開發