Java tutorial
package com.repay.android.frienddetails; import java.util.List; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; /** * Property of Matt Allen * mattallen092@gmail.com * http://mattallensoftware.co.uk/ * * This software is distributed under the Apache v2.0 license and use * of the Repay name may not be used without explicit permission from the project owner. * */ public class TabViewAdapter extends FragmentPagerAdapter { private List<Fragment> fragments; public TabViewAdapter(FragmentManager fm, List<Fragment> fragments) { super(fm); this.fragments = fragments; } @Override public Fragment getItem(int position) { return this.fragments.get(position); } @Override public int getCount() { return this.fragments.size(); } public void setItem(int position, Fragment fragment) { this.fragments.remove(position); this.fragments.add(position, fragment); this.notifyDataSetChanged(); } }