Does a recreated activity remember the original intent started it?

While checking the documentation about using onSaveInstanceState, a question popped up.

Let's say I'm using an app with several activities and now I'm in a specific activity that got started by a previous one. The current activity accepts extra values from the previous one.

If I get a phone call and then navigate back to the activity, it's recreated. But will it remember the original intent of the previous activity that started it? will it be able to get the extra variables from it after recreating itself?

To simplify things:

Activity A starts Activity B (and passing extras to it). Then (while in B) there's an incoming call. I go back to the app so B is recreated- will I still be able to get the extras passed from original the original activity A ?


Solution 1:

Yes it will, the simplest way to check that is to rotate the screen when the 2nd activity is running, it will be destroyed and then recreated and you will notice that you can still get the extras. Try it and see by your own.

Solution 2:

Yes, it will be the same intent.

Also just to clarify, when you leave Activity B to answer the call, and go back, Activity B is not necessarily re-created. It is only re-created if the process containing it was killed to reclaim resources. It happens often that in the scenario you describe, Activity B still exists.

For a similar discussion see: Android - Is the intent preserved during activity recreation?