I understand the concept of the back-stack, so I’m pretty sure this isn’t possible but thought I’d ask anyway.
If it isn’t, then what is the approach to simulate this behavior? For instance, I have an Activity “A1” that starts another Activity “A2”. “A2” alters the content that “A1” shows. When the back button is pressed, the old “A1” is displayed with the old content. Whenever “A1” is called again then the new “A1” will show the new content.
How do developers get around this issue?
When a user press the back-button the A1 activity comes back to the foreground. This will not trigger the
onCreate()so you can’t use that but if you look at the Activity Lifecycle theonResume()method will be called.So if you move the displaying of the content in activity A1 from the
onCreate()to theonResume()method it should work fine in both situations, when the activity is started and when you return to the activity using the back-button.