Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pulltorefreshexample : sharing my solution to fixing a crash #66

Open
androidseb opened this issue Aug 5, 2013 · 0 comments
Open

pulltorefreshexample : sharing my solution to fixing a crash #66

androidseb opened this issue Aug 5, 2013 · 0 comments

Comments

@androidseb
Copy link

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant