Example #1
0
 /** Returns a new instance of this fragment for the given section number. */
 public static LeftFragment newInstance(int sectionNumber) {
   LeftFragment fragment = new LeftFragment();
   Bundle args = new Bundle();
   args.putInt(ARG_SECTION_NUMBER, sectionNumber);
   fragment.setArguments(args);
   return fragment;
 }
Example #2
0
    @Override
    public Fragment getItem(int position) {
      // getItem is called to instantiate the fragment for the given page.
      // Return a PlaceholderFragment (defined as a static inner class below).

      switch (position) {
        case 0:
          return LeftFragment.newInstance(position);
        case 1:
          return CenterFragment.newInstance(position);
        case 2:
          return RightFragment.newInstance(position);
        default:
          return null;
      }
    }