@@ -0,0 +1,1182 @@
+package com.spiddekauga.android.ui.list;%0A%0Aimport android.app.Fragment;%0Aimport android.app.FragmentManager;%0Aimport android.support.annotation.NonNull;%0Aimport android.util.SparseArray;%0A%0A/**%0A * Improved Fragment Pager adapter that can return an instance of the fragment%0A */%0Apublic abstract class FragmentPagerAdapter%3CFragmentType extends Fragment%3E extends android.support.v13.app.FragmentPagerAdapter %7B%0Aprivate SparseArray%3CFragmentType%3E mFragments = new SparseArray%3C%3E();%0A%0Aprotected FragmentPagerAdapter(@NonNull FragmentManager fragmentManager) %7B%0A%09super(fragmentManager);%0A%7D%0A%0A/**%0A * Get the instance of the item at position. Creates a new instance if none exists%0A * @param position position of item to get%0A * @return Fragment instance of the item at position.%0A */%0A@Override%0Apublic FragmentType getItem(int position) %7B%0A%09FragmentType fragment = mFragments.get(position);%0A%09if (fragment == null) %7B%0A%09%09fragment = instantiateItem(position);%0A%09%09mFragments.append(position, fragment);%0A%09%7D%0A%09return fragment;%0A%7D%0A%0A/**%0A * Create a new instance of the item at the specified position%0A * @return new fragment instance for this position%0A */%0Aprotected abstract FragmentType instantiateItem(int position);%0A%7D%0A

Create new FragmentPagerAdapter to store existing fragments