pulltorefreshexample : sharing my solution to fixing a crash
androidseb opened this issue · 0 comments
First, thank you very much for this awesome library. I'm new to Android SDK and it took me no time to use thanks to the example.
There is a bug crashing the app in the example project, I'm pretty sure it's thread related...
This crash can happen anytime while touching the list, but it is easy to reproduce by spamming the drag down gesture while "loading".
To fix it I changed the PullToRefreshActivity.java file like this
@Override
protected void onPostExecute(final String[] result) {
//previous code
// mListItems.addFirst("Added after refresh...");
//replacement code
((ArrayAdapter) getListAdapter()).insert("Added after refresh...", 0);
I presume the reason of the crash was that the ArrayAdapter was iterating mListItems while it was modified, not sure, but anyway this modification seems to work for me.
Feel free to share any comment :)