示例#1
0
 protected Fragment createFragment() {
   long runId = getIntent().getLongExtra(EXTRA_RUN_ID, -1);
   if (runId != -1) {
     return RunFragment.newInstance(runId);
   } else {
     return new RunFragment();
   }
 }
  @Override
  public Fragment getItem(int position) {

    Bundle fragmentBundle = new Bundle();
    fragmentBundle.putString(BundleKeys.EVENTID_KEY, eventID);
    switch (position) {
      case 0:
        ParticipantFragment tab1 = new ParticipantFragment();
        tab1.setArguments(fragmentBundle);
        return tab1;
      case 1:
        RunFragment tab2 = new RunFragment();
        tab2.setArguments(fragmentBundle);
        return tab2;

      default:
        return null;
    }
  }