/* * (non-Javadoc) * @see android.app.Activity#onPrepareDialog(int, android.app.Dialog) */ @Override protected void onPrepareDialog(int id, Dialog dialog) { switch (id) { case DIALOG_LOGCONTROL: updateDialogState(mLoggerServiceManager.getLoggingState()); break; default: break; } super.onPrepareDialog(id, dialog); }
@Override protected void onResume() { super.onResume(); mLoggerServiceManager.startup( this, new Runnable() { public void run() { showDialog(DIALOG_LOGCONTROL); } }); }
public void onClick(View v) { int id = v.getId(); Intent intent = new Intent(); switch (id) { case R.id.logcontrol_start: long loggerTrackId = mLoggerServiceManager.startGPSLogging(null); // Start a naming of the track Intent namingIntent = new Intent(ControlTracking.this, NameTrack.class); namingIntent.setData(ContentUris.withAppendedId(Tracks.CONTENT_URI, loggerTrackId)); startActivity(namingIntent); // Create data for the caller that a new track has been started ComponentName caller = ControlTracking.this.getCallingActivity(); if (caller != null) { intent.setData(ContentUris.withAppendedId(Tracks.CONTENT_URI, loggerTrackId)); setResult(RESULT_OK, intent); } break; case R.id.logcontrol_pause: mLoggerServiceManager.pauseGPSLogging(); setResult(RESULT_OK, intent); break; case R.id.logcontrol_resume: mLoggerServiceManager.resumeGPSLogging(); setResult(RESULT_OK, intent); break; case R.id.logcontrol_stop: mLoggerServiceManager.stopGPSLogging(); setResult(RESULT_OK, intent); break; default: setResult(RESULT_CANCELED, intent); break; } finish(); }
@Override protected void onPause() { super.onPause(); mLoggerServiceManager.shutdown(this); paused = true; }