Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SectionsPagerAdapter extends FragmentStatePagerAdapter {
- private FragmentManager fm;
- private ArrayList<Fragment> fragments = new ArrayList<Fragment>();
- private LoadingFragment loadingFragment = new LoadingFragment();
- public SectionsPagerAdapter(FragmentManager fm) {
- super(fm);
- fragments.add(loadingFragment);
- this.fm = fm;
- }
- public void addFragment(Fragment fragment) {
- fragments.add(fragment);
- if (fragments.contains(loadingFragment))
- fragments.remove(loadingFragment);
- notifyDataSetChanged();
- }
- @Override
- public int getItemPosition(Object object) {
- return POSITION_NONE;
- }
- @Override
- public Fragment getItem(int position) {
- return fragments.get(position);
- }
- @Override
- public int getCount() {
- return fragments.size();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement