Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save BurningDroid/ea8e6eefe2893e81f75d87516213e6b4 to your computer and use it in GitHub Desktop.
Save BurningDroid/ea8e6eefe2893e81f75d87516213e6b4 to your computer and use it in GitHub Desktop.
@Override
public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
super.onViewStateRestored(savedInstanceState);
if (savedInstanceState != null) {
mLayoutManagerSavedState = savedInstanceState.getParcelable("key");
}
}
@Override
public void onStart() {
super.onStart();
if (getArguments() != null) {
mDataArray = getArguments().getParcelableArrayList("key_datas");
mAdapter = new MyAdapter(mDataArray, getContext());
mRecyclerView.setAdapter(mAdapter);
if (mLayoutManagerSavedState != null) {
mRecycleriew.getLayoutManager().onRestoreInstanceState(mLayoutManagerSavedState);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment