Android Open Source - NavigationDrawerExample Tabs Pager Adapter






From Project

Back to project page NavigationDrawerExample.

License

The source code is released under:

Apache License

If you think the Android project NavigationDrawerExample listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.qiwary.navigationdrawerexample.adapter;
/*from   w  w  w.j  ava 2 s . c o  m*/
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import net.qiwary.navigationdrawerexample.fragment.AboutFragment;
import net.qiwary.navigationdrawerexample.fragment.HelpFragment;

/**
 * Created by avew on 12/5/14.
 */
public class TabsPagerAdapter extends FragmentPagerAdapter {

  private final String[] TITLES = {"Tab1", "Tab2", "Tab3", "Tab4", "Tab5"};

  public TabsPagerAdapter(FragmentManager fm) {
    super(fm);
  }

    @Override
  public Fragment getItem(int position) {
    switch (position) {
      case 0:
        return new HelpFragment();
      case 1:
        return new AboutFragment();
      case 2:
        return new AboutFragment();
      case 3:
        return new AboutFragment();
      case 4:
        return new AboutFragment();
    }
    return null;
  }

  @Override
  public CharSequence getPageTitle(int position) {
    return TITLES[position];
  }

  @Override
  public int getCount() {
    return TITLES.length;
  }
}




Java Source Code List

net.qiwary.navigationdrawerexample.ApplicationTest.java
net.qiwary.navigationdrawerexample.MainActivity.java
net.qiwary.navigationdrawerexample.adapter.SlideMenuAdapter.java
net.qiwary.navigationdrawerexample.adapter.TabsPagerAdapter.java
net.qiwary.navigationdrawerexample.fragment.AboutFragment.java
net.qiwary.navigationdrawerexample.fragment.HelpFragment.java
net.qiwary.navigationdrawerexample.fragment.HomeFragment.java
net.qiwary.navigationdrawerexample.fragment.TabsDraftFragment.java
net.qiwary.navigationdrawerexample.model.NavDrawerItem.java