@Override
    public void onSaveInstanceState(Bundle savedInstanceState) {
        // Save currently selected layout manager.
        savedInstanceState.putSerializable(KEY_LAYOUT_MANAGER, mCurrentLayoutManagerType);
        super.onSaveInstanceState(savedInstanceState);
    }
Set RecyclerView's LayoutManager to the one given.

@param layoutManagerType Type of layout manager to switch to.
RecyclerView/Application/src/main/java/com/example/android/recyclerview/RecyclerViewFragment.java