Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
Fix a fragment loadermanager bug that can lead to memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitletondor committed Jul 15, 2016
1 parent 77dbdee commit e0e0057
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,15 @@ public abstract class BaseFragment<P extends BasePresenter<V>, V> extends Fragme
mUniqueLoaderIdentifier = savedInstanceState == null ? BaseActivity.sViewCounter.incrementAndGet() : savedInstanceState.getInt(LOADER_ID_SAVED_STATE);

injectDependencies();
}

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState)
{
super.onActivityCreated(savedInstanceState);

getLoaderManager().initLoader(mUniqueLoaderIdentifier, null, this).startLoading();
// See http://stackoverflow.com/a/32289822/2508174 for the use of getActivity().getSupportLoaderManager()
getActivity().getSupportLoaderManager().initLoader(mUniqueLoaderIdentifier, null, this).startLoading();
}

private void injectDependencies()
Expand Down

0 comments on commit e0e0057

Please sign in to comment.