Blame view

PremiereActivite/app/src/main/java/com/example/app_10p5/PagerAdapter.java 1.15 KB
c8059613   JLo'w   Re-fonte de l'app...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  package com.example.app_10p5;
  
  /**
   * Created by beaus on 24/04/2016.
   */
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentStatePagerAdapter;
  
  public class PagerAdapter extends FragmentStatePagerAdapter {
      int mNumOfTabs;
  
      public PagerAdapter(FragmentManager fm, int NumOfTabs) {
          super(fm);
          this.mNumOfTabs = NumOfTabs;
      }
  
      @Override
      public Fragment getItem(int position) {
  
          switch (position) {
              case 0:
                  TabFragment1 tab1 = new TabFragment1();
                  return tab1;
              case 1:
                  TabFragment2 tab2 = new TabFragment2();
                  return tab2;
              case 2:
                  TabFragment3 tab3 = new TabFragment3();
                  return tab3;
              case 3:
                  TabFragment4 tab4 = new TabFragment4();
                  return tab4;
              case 4:
                  TabFragment5 tab5 = new TabFragment5();
                  return tab5;
              default:
                  return null;
          }
      }
  
      @Override
      public int getCount() {
          return mNumOfTabs;
      }
  }