Esempio n. 1
0
 @Override
 protected Fragment createFragment() {
   long runId = getIntent().getLongExtra(EXTRA_RUN_ID, -1);
   if (runId != -1) {
     return RunMapFragment.newInstance(runId);
   } else {
     return new RunMapFragment();
   }
 }
 // Pull a run from the supplied Cursor and retrieve a RunMapFragment for it using its RunId
 @Override
 public Fragment getItem(Context context, Cursor cursor) {
   RunDatabaseHelper.RunCursor runCursor = (RunDatabaseHelper.RunCursor) cursor;
   long runId = runCursor.getRun().getId();
   if (runId != -1) {
     return RunMapFragment.newInstance(runId);
   } else {
     // We should never get here - Runs are assigned a RunId as soon as they get created and
     // before they get added to the RunFragment ViewPager, but we have return something in
     // an "else" block to keep the compiler happy.
     return null;
   }
 }