Skip to content

Commit

Permalink
QuestionFragment, SubjectExtrasFragment: Avoid repeat onLoadFinished(…
Browse files Browse the repository at this point in the history
…) calls.

This seems to be an Android bug. It causes us to do the same work repeatedly.
  • Loading branch information
murraycu committed Oct 9, 2014
1 parent 841bac4 commit 3438f8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,11 @@ public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {

mLoaderFinished = true;
updateIfReady();

// Avoid this being called twice (actually multiple times), which seems to be an Android bug:
// See http://stackoverflow.com/questions/14719814/onloadfinished-called-twice
// and https://code.google.com/p/android/issues/detail?id=63179
getLoaderManager().destroyLoader(URL_LOADER);
}

private void updateIfReady() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {

mLoaderFinished = true;
updateIfReady();

// Avoid this being called twice (actually multiple times), which seems to be an Android bug:
// See http://stackoverflow.com/questions/14719814/onloadfinished-called-twice
// and https://code.google.com/p/android/issues/detail?id=63179
getLoaderManager().destroyLoader(URL_LOADER);
}

private void updateIfReady() {
Expand Down

0 comments on commit 3438f8a

Please sign in to comment.