http://blog.csdn.net/l_serein/article/details/7706338
Reproduced:
Describe the scene:
There are several categories on the menu bar, click on each category, and the ListView below shows the corresponding content according to the classification.
--------------------------
1. An exception occurred when switching categories. The description is as follows:
E/androidruntime (8131): Java.lang.IndexOutOfBoundsException:Invalid index One, size is 0
E/androidruntime (8131): at Java.util.ArrayList.throwIndexOutOfBoundsException (arraylist.java:257)
E/androidruntime (8131): at android.widget.HeaderViewListAdapter.isEnabled (headerviewlistadapter.java:164)
The probable cause is this:
When I switch the classification, the ListView must first clear, then the ListView again scrolls the time to write down the next time the index. When you load it, there is a indexoutofboundsexception. So, when I switch categories, I add
Mannouncementlv.setadapter (Mbulletinadapter);
Plus this is OK, do not report boundary overflow error ...
Reprint End
I have the same problem with this great God, which is solved by the way of the great God.
This is actually quite the same as refreshing the function, or you can use the Listviewadapter.notifydatasetchanged () method to solve this problem, both when the value of the ListView changes, you need to call this method to refresh
Android ListView Load encountered problems