Skip to content

Instantly share code, notes, and snippets.

@EfeBudak
Created May 30, 2017 08:35
Show Gist options
  • Save EfeBudak/5f7328413e836279ac106bf046f631ee to your computer and use it in GitHub Desktop.
Save EfeBudak/5f7328413e836279ac106bf046f631ee to your computer and use it in GitHub Desktop.
Android Pagination with MVP
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
mPresenter = new Presenter(
fragment,
SchedulerProvider.getInstance(),
Repository.getInstance(
LocalDataSource.getInstance(),
RemoteDataSource.getInstance()));
if (savedInstanceState != null) {
mPresenter.restoreCurrentPage(savedInstanceState.getInt(BUNDLE_CURRENT_PAGE));
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putInt(BUNDLE_CURRENT_PAGE, mPresenter.getCurrentPage());
super.onSaveInstanceState(outState);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment