Skip to content

pulltorefreshexample : sharing my solution to fixing a crash #66

@androidseb

Description

@androidseb

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions