How to update the intent this activity will started with after recovering from background?

I don't know if Intents can be changed or not, although the concept seems wrong to me (it was after all the Intent that started your Activity and that hasn't changed) I propose storing the successful execution of doSomethingWithValue() in an attribute, say mSomethingDone. When the Activity is taken down by the system (not the user), onRetainNonConfigurationInstance is called. Implement that: Override public Object onRetainNonConfigurationInstance() { return mSomeThingDone; } Now retrieve the boolean in your onCreate: Override public void onCreate(Bundle savedInstanceState) { final Object data = getLastNonConfigurationInstance(); if (data!

= null) { mSomeThingDone = (Boolean)data; } } And then check if you need to run your doSomethingWithValue depending on the value of mSomeThingDone.

I don't know if Intents can be changed or not, although the concept seems wrong to me (it was after all the Intent that started your Activity and that hasn't changed). I propose storing the successful execution of doSomethingWithValue() in an attribute, say mSomethingDone. When the Activity is taken down by the system (not the user), onRetainNonConfigurationInstance is called.

Implement that: @Override public Object onRetainNonConfigurationInstance() { return mSomeThingDone; } Now retrieve the boolean in your onCreate: @Override public void onCreate(Bundle savedInstanceState) { final Object data = getLastNonConfigurationInstance(); if (data! = null) { mSomeThingDone = (Boolean)data; } } And then check if you need to run your doSomethingWithValue depending on the value of mSomeThingDone.

Such approach works when I move app to background by Home button, but when I move the app to background by Back button the behavior remains wrong as before. – Solvek Feb 6 at 14:00 You should consider the Activity Lifecycle (developer.android. Com/reference/android/app/…) here.

Apps are rarely destroyed when they go into the background. If they aren't destroyed, onCreate is not called when they get sent to the foreground again. I propose logging creation, resuming and starting events by adding Log statements to onCreate, onResume and onStart.

Check if onCreate is called when the problem appears. – kread Feb 6 at 16:26.

Yes, I tried removeExtra then setIntent - it does not work. – Solvek Feb 6 at 13:46.

Note that my activity has attribute android:launchMode="singleTask" in manifest. After executing doSomethingWithValue I want to clear "value" extra from the intent, so when next time the activity is recovering from background the intent returned but getIntent() should not have "value" extra. How can I clear this value for the next execution of onCreate?

SetIntent does not work here. In other words when I press back button and then return to my app doSomethingWithValue(val) is executed again but I do not need this.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions