// 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;
   }
 }
 // Set the ViewPager's current (displayed) item to the specified Run.
 private void setViewPager(RunDatabaseHelper.RunCursor cursor, long runId) {
   cursor.moveToFirst();
   Log.i(TAG, "In setViewPager(), runId is " + runId);
   // Iterate over the Runs in the cursor until we find the one with an Id equal to the one we
   // specified in the runId parameter, then set the ViewPager's current item to that Run
   while (!cursor.isAfterLast()) {
     if (cursor.getRun().getId() == runId) {
       mViewPager.setCurrentItem(cursor.getPosition());
       mRunManager
           .mPrefs
           .edit()
           .putInt(Constants.ADAPTER_POSITION, mViewPager.getCurrentItem())
           .apply();
       break;
     }
     cursor.moveToNext();
   }
 }