Ejemplo n.º 1
0
 private void deleteRun() {
   Log.i(TAG, "In Delete Run Menu, Runs in the adapter: " + mViewPager.getAdapter().getCount());
   // First, stop location updates if the Run we're deleting is currently being tracked
   if (mRunManager.isTrackingRun(mRunManager.getRun(mRunId))) {
     try {
       mLocationService.send(Message.obtain(null, Constants.MESSAGE_STOP_LOCATION_UPDATES));
     } catch (RemoteException e) {
       Log.i(TAG, "Caught RemoteException while trying to send MESSAGE_STOP_LOCATION_UPDATES");
     }
     mRunManager.stopRun();
   }
   Log.i(TAG, "Runs in Adapter before Run deletion: " + mAdapter.getCount());
   // Now order the Run to be deleted. The Adapter, Subtitle and Loader will get reset
   // when the results of the Run deletion get reported to the ResultsReceiver
   Log.i(TAG, "Trying to delete Run " + mRunId);
   int locations = mRunManager.queryLocationsForRun(mRunId).getCount();
   Log.i(TAG, "There are " + locations + " locations to be deleted for Run " + mRunId);
   mAdapter.startUpdate(mViewPager);
   TrackingLocationIntentService.startActionDeleteRun(this, mRunId);
 }