Skip to content

Instantly share code, notes, and snippets.

Created June 25, 2017 16:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
class MainLoader extends Loader<MainPresenter> {
private MainPresenter presenter;
/* When the loader is being created, we instantiate the
presenter also and keep it's object as private */
MainLoader(Context context, MainPresenter presenter) {
this.presenter = presenter;
/* This function is called when activity is being started.
Hence we deliver the result, our presenter, here. If the
activity is destroyed in rotation, the loader isn't created
again as system made sure it survived the rotation, and
thus when starting of activity calls this function again
automatically and we deliver the pre-rotation presenter as
our result to the activity in onLoadFinished callback*/
protected void onStartLoading() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment