It is common to change the UI when the ListView list refreshes data.
LOG:
The content of the adapter has changed but the ListView does not receive a notification. Make sure the content of your adapter are not modified from a background thread, but only from the UI thread.
The log in the DDMS cannot be positioned to the exact error location. To check for errors, start with the following points:
1, check the thread, determine that there is no direct call adapter in background thread, if there is, please remove the relevant code to handler processing;
2, try to put the data in the adapter class management, do not need to clear the information (write clear ()), timely use notifydatasetchanged () refresh;
3, in the activity or fragment suitable position (Onpause/onstop) to check the thread in time, there is adapter data processing related should be stopped immediately;
4. This error often occurs after the activity is dormant, mainly by using adapter less carefully. If the reason is not found, stop all background thread in the OnPause () function and empty the data in adapter at the front of the Onresume () function, and adapter.notifydatasetchanged (). Then re-update the load data, which generally resolves the issue.
The mistake I made was:
The adapter data is emptied adapter.getDateList.clear () in advance, and the adapter.notifydatasetchanged () is not called in time, Causes the ListView to throw java.lang.IllegalStateException this exception without data.
User experience: Refresh page or drop-down refresh, finger Click any UI, cause crashes.
Workaround: Write Adapter.getDateList.clear () and adapter.notifydatasetchanged () together
Android Development: Java.lang.IllegalStateException Error