I am puzzled by this behavior that I experience in the application that I am developing ...
Short:
Intent data is not cleared when the user presses the back button to exit the application, and then presses the last button to re-enter the application. (In each other case, intent data is cleared)
Long
I have a screensaver application that is used to collect data that is passed from a URI scheme. Then I set the intent to redirect the data to the main action. The main action has fragments and is based on a master / part template.
Intent data is cleared in all cases, such as pressing the home button, then returning to the application, pressing the button for the latest applications, and then returning to the application, etc. The only case where the intent data is not cleared when the user clicks the back button and then the Recent Applications button to return to the application.
Relevant code fragments that include intent:
// Splash Screen Activity @Override protected void onPostExecute(Void result) { // Data is done downloading, pass notice and app ids to next activity Intent intent = new Intent(getBaseContext(), ListActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("id1", id1); intent.putExtra("id2", id2); intent.putExtra("id3", id3); startActivity(intent); finish(); } // ListActivity retrieving intent data Intent intent = getIntent(); if (intent != null) { this.id1 = intent.getExtras().getString("id1"); this.id2 = intent.getExtras().getString("id2"); this.id3 = intent.getExtras().getString("id3"); } // ListActivity clearing intent data @Override public void onPause() { super.onPause(); // Clear intent data Intent intent = getIntent(); intent.putExtra("id1", ""); intent.putExtra("id2", ""); intent.putExtra("id3", ""); }
I want to note that I also tried to use aim.removeExtra ("id1"), but that didn't work either.
Any idea what is going on? This is similar to the fact that Android retains the previous intention, although onPause () is always called to clear the intent data.
source share