+1 vote
in Other by
I have android app with 3 Activities.

Scenario: Home Screen - >Launch App - >Activity A ->Activity B -> Activity C - >Press Home button -> Home Screen - >Launch App

I am expecting Activity C to be shown. but app is getting relaunched.

In iOS 4.0 or Above app comes to same state on relaunching. In Android do we need to do something extra to get this behavior?

One More Scenario: If you push the App in debug mode then above behavior is not seen. If you create apk and push, then only app is not retaining its state.

JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Check out the activity lifecycle documentation

Also take a look at onPause() and onResume() methods. You will have to override them to store your app's state. In this case, you may have to store which activity was in the foreground when the app was closed.

See this question to see how to start an activity. You can start an activity in your onResume() method.

Related questions

+1 vote
asked Feb 1, 2022 in Other by DavidAnderson
+1 vote
asked Feb 1, 2022 in Other by DavidAnderson
...