/** * Any time we are paused we need to save away the current state, so it will be restored correctly * when we are resumed. */ @Override protected void onPause() { if (reverseGeocoderTask != null) { reverseGeocoderTask.cancel(true); } final String selectedCategories = getSelectedCategories(); SharedPreferences.Editor editor = getPreferences(0).edit(); editor.putString("title", mIncidentTitle.getText().toString()); editor.putString("description", mIncidentDesc.getText().toString()); editor.putString("location", mIncidentLocation.getText().toString()); editor.putString("latitude", mLatitude.getText().toString()); editor.putString("longitude", mLongitude.getText().toString()); if (selectedCategories != null) { editor.putString("categories", selectedCategories); } editor.putString("photo", Preferences.fileName); editor.commit(); // Notify user that report has been saved as draft. if (draft) { Util.showToast(this, R.string.message_saved_as_draft); } super.onPause(); }
@Override protected void onPause() { super.onPause(); if (reverseGeocoderTask != null) { reverseGeocoderTask.cancel(true); } }