221

Hopefully someone can help me figure out, if not a solution, at least an explanation for a behaviour.

The Problem:

On some devices, pressing the launcher icon results in the current task being resumed, on others it results in the initial launch intent being fired (effectively restarting the app). Why does this happen?

The Detail:

When you press the "Launcher Icon" the app starts normally - That is, I assume, an Intent is launched with the name of your first Activity with the action android.intent.action.MAIN and the category android.intent.category.LAUNCHER. This can't always be the case however:

On the majority of devices, if you press the launcher icon after the app is already running, the currently running Activity in that process is resumed (NOT the initial Activity). It resumes in the same way as if you had selected it from the "Recent Tasks" in the OS menu. This is the behaviour I want on all devices.

However, on selected other devices different behaviour occurs:

  • On the Motorola Xoom, when you press the launcher icon, the App will always start the initial launch Activity regardless of what is currently running. I assume that the launcher icons always start the "LAUNCHER" intent.

  • On the Samsung Tab 2, when you press the launcher icon, if you have just installed the app, it will always launch the initial Activity (Same as the Xoom) - however, after you restart the device after the install, the launcher icon will instead resume the app. I assume that these devices add "installed apps" into a lookup table on device startup which allow the launcher icons to correctly resume running tasks?

I've read many answer that sound similar to my problem but simply adding android:alwaysRetainTaskState="true" or using launchMode="singleTop" to the Activity are not the answer.

Edit:

After the most recent launch of this app, we find that this behaviour has begun to occur on all devices after the first restart. Which seems crazy to me but looking through the restart process, I can't actually find what's going wrong.

Graeme
  • 25,714
  • 24
  • 124
  • 186
  • 2
    This may seem like a trivial question to ask, but did you set "Don't keep activities" to true in your develop options for the Xoom? – Andrew Schuster Oct 23 '13 at 15:43
  • Nope (I wish! :)) - I've logged the lifecycle of each Activity and the Activities in the background as still available (They're stopped - not destroyed). The OS seems to call `finish()` on them in instances where it begins the first `Activity` again instead of resuming them. – Graeme Oct 23 '13 at 15:45
  • 1
    If you have pressed the home button and then click the launcher icon the resume behaviour is the default for android as you are probably aware. However if you press the back button to return to the home screen most phones will finish() the app. Is it possible whatever method you are using to exit the app is different on the different devices? Could you log out the onKeyUpEvent to check that some aren't handling the hard/sof tkeys strangely? – Nick Cardoso Jan 27 '14 at 21:02
  • 2
    Nope - I'm sure of the problem as stated above. Using home to put the app in the background (not back, which you're right would finish() the Activity). It's possible on the Xoom to resume the app from the Task List (just not from the Launcher) so the backstack has definitely *not* been killed. – Graeme Jan 28 '14 at 15:31
  • Gave bounty to question that doesn't work? Everyone gets downvoted. – danny117 Apr 23 '14 at 14:12
  • 1
    Answer with the bounty is the way to fix the problem described in the question. Marked my own answer as "correct" because although sometimes the problem is caused by an app bug in the launcher (as noted in his answer) my particular problem was caused by Task switching. **The solution to both problem is fixed by his solution.** – Graeme Nov 06 '14 at 15:28

9 Answers9

274

The behavior you are experiencing is caused by an issue that exists in some Android launchers since API 1. You can find details about the bug as well as possible solutions here: https://code.google.com/p/android/issues/detail?id=2373.

It's a relatively common issue on Samsung devices as well as other manufacturers that use a custom launcher/skin. I haven't seen the issue occur on a stock Android launcher.

Basically, the app is not actually restarting completely, but your launch Activity is being started and added to the top of the Activity stack when the app is being resumed by the launcher. You can confirm this is the case by clicking the back button when you resume the app and are shown the launch Activity. You should then be brought to the Activity that you expected to be shown when you resumed the app.

The workaround I chose to implement to resolve this issue is to check for the Intent.CATEGORY_LAUNCHER category and Intent.ACTION_MAIN action in the intent that starts the initial Activity. If those two flags are present and the Activity is not at the root of the task (meaning the app was already running), then I call finish() on the initial Activity. That exact solution may not work for you, but something similar should.

Here is what I do in onCreate() of the initial/launch Activity:

    if (!isTaskRoot()
            && getIntent().hasCategory(Intent.CATEGORY_LAUNCHER)
            && getIntent().getAction() != null
            && getIntent().getAction().equals(Intent.ACTION_MAIN)) {

        finish();
        return;
    }
starkej2
  • 11,391
  • 6
  • 35
  • 41
  • Can you explain `isTaskRoot()` ? – Graeme Apr 23 '14 at 08:56
  • @Graeme isTaskRoot() will return true if the Activity is at the bottom of the Activity stack of that particular task. – starkej2 Apr 23 '14 at 12:36
  • This doesn't create a perfect resume on all devices. – danny117 Apr 23 '14 at 14:11
  • @danny117 What devices does it not work on? Works on every device I've tried so far. – starkej2 Apr 23 '14 at 17:46
  • Fail just now this didn't work with the app I was testing. The app just finished when I tried to resume from the task list. – danny117 Apr 23 '14 at 18:02
  • 1
    Implemented this solution and it definitely helps. Also used this in conjunction with 'Intent resumeIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName()); resumeIntent.setAction(Intent.ACTION_MAIN); resumeIntent.addCategory(Intent.CATEGORY_LAUNCHER); context.startActivity(resumeIntent);' code to resume the current task and then build upon it from static context. Very very useful. – Graeme May 01 '14 at 11:40
  • 5
    So far this works for me with no adverse side effects so far. Based on the logical assumptions, I see no reason why it isn't valid. – javahead76 Aug 13 '14 at 05:56
  • 1
    I was confronted with the same issue on a Nexus 4.Tried this and it definitely works. Thank you very much for the answer. – Mythul Oct 14 '14 at 17:04
  • @Graeme can u pls tell me how u used this solution ?? in which activity u used this ? have u used in launcher activity ? ? – Erum May 11 '15 at 04:40
  • @Erum yes, you use it in your launcher activity – starkej2 May 11 '15 at 11:31
  • 3
    I think this is the proper way to deal with this bug. Works for me. – Sokolof Jul 10 '15 at 22:31
  • @Graeme Are you calling `Finish()` as well as the code you posted in your comment? If so, are you calling `Finish()` before or after your code? Thanks. – hvaughan3 Jun 13 '16 at 18:47
  • That code in various places - depends on the circumstance as to if I call finish. – Graeme Jun 16 '16 at 09:29
  • 4
    did the job for me, verified on about 8 different devices. thanks very much! – shaya ajzner Nov 27 '16 at 15:02
  • please add getIntent() != null to your if close – Volodymyr Machekhin Mar 06 '17 at 13:56
  • How can the intent be null in onCreate() @VolodymyrMachekhin – starkej2 Mar 06 '17 at 16:17
  • 1
    It can be null only in 2 cases that are almost impossible here, just added a suggestion to prevent event them. http://stackoverflow.com/questions/37856407/can-activity-getintent-ever-return-null – Volodymyr Machekhin Mar 07 '17 at 09:06
  • I don't think any of those cases are relevant here. – starkej2 Mar 07 '17 at 12:53
  • 3
    WOOOOOW fixed my problem ive been looking for a fix for the past 2 hours – Jean Raymond Daher Jun 15 '17 at 17:28
  • This is going to help me with my problem, I'm sure! Still relevant on a galaxy s8 – Russ Wheeler Aug 09 '18 at 14:26
  • 2
    Thanks @starkej2. Worked like a charm. – Rajeev Sahu Jan 22 '19 at 09:19
  • If you are releasing some resources ,e.g., database connection in onDestroy method of activity then you need to add some more logic to prevent this happening when finish is called due to this workaround. – Zain Ali Apr 05 '19 at 07:11
  • Here is the new issue, since the one linked in the answer was linked as obsolete. https://issuetracker.google.com/issues/64108432 Now it's fixed, and will be released in a future version. Who knows which one it is, or if it will be a backward fix or only on the latest version. – juancamilo87 Oct 11 '19 at 14:49
  • I'm finding I can work around this by setting the activity's launch mode to "singleTask". There's a few other choices worth looking at, the "back stack" is a pretty complicated concept to think about. – OwenP Dec 05 '19 at 20:26
  • i came two time and went to this answer by thinking who will read this much stuff but working as expected thank you – Mohd Qasim Sep 26 '20 at 18:30
  • works like a charm for me! that was amazing solution to cover the OS bug. thanks to save my days! – imansdn Oct 03 '21 at 08:48
64

This question is still relevant in 2016. Today a QA tester reported an app of mine restarting rather than resuming from the stock launcher in Android M.

In reality, the system was adding the launched activity to the current task-stack, but it appeared to the user as if a restart had occurred and they'd lost their work. The sequence was:

  1. Download from play store (or sideload apk)
  2. Launch app from play store dialog: activity A appears [task stack: A]
  3. Navigate to activity B [task stack: A -> B]
  4. Press 'Home' button
  5. Launch app from app drawer: activity A appears! [task stack: A -> B -> A] (user could press 'Back' button to get to activity 'B' from here)

Note: this problem does not manifest for debug APK's deployed via ADB, only in APKs downloaded from the Play Store or side-loaded. In the latter cases, the launch intent from step 5 contained the flag Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT, but not in the debug cases. The problem goes away once the the app has been cold-started from the launcher. My suspicion is the Task is seeded with a malformed (more accurately, non-standard) Intent that prevents the correct launch behavior until the task is cleared entirely.

I tried various activity launch modes, but those settings deviate too much from standard behavior the user would expect: resuming the task at activity B. See the following definition of expected behavior in the guide to Tasks and Back Stack, at the bottom of the page under 'Starting a Task':

An intent filter of this kind causes an icon and label for the activity to be displayed in the application launcher, giving users a way to launch the activity and to return to the task that it creates any time after it has been launched.

I found this answer to be relevant and inserted the following into the 'onCreate' method of my root activity (A) so that it resumes appropriately when the user opens the application.

                    /**
     * Ensure the application resumes whatever task the user was performing the last time
     * they opened the app from the launcher. It would be preferable to configure this
     * behavior in  AndroidMananifest.xml activity settings, but those settings cause drastic
     * undesirable changes to the way the app opens: singleTask closes ALL other activities
     * in the task every time and alwaysRetainTaskState doesn't cover this case, incredibly.
     *
     * The problem happens when the user first installs and opens the app from
     * the play store or sideloaded apk (not via ADB). On this first run, if the user opens
     * activity B from activity A, presses 'home' and then navigates back to the app via the
     * launcher, they'd expect to see activity B. Instead they're shown activity A.
     *
     * The best solution is to close this activity if it isn't the task root.
     *
     */

    if (!isTaskRoot()) {
        finish();
        return;
    }

UPDATE: moved this solution away from parsing intent flags to querying if the activity is at the root of the task directly. Intent flags are difficult to predict and test with all the different ways there are to open a MAIN activity (Launch from home, launch from 'up' button, launch from Play Store, etc.)

Community
  • 1
  • 1
Rich Ehmer
  • 2,764
  • 23
  • 18
  • 6
    "The problem goes away once the the app has been cold-started from the launcher." This is the weirdest part and I observed it too--killing the app after the first launch, it starts behaving normally again. Such an odd bug. Thanks for analyzing it so throughly and for the solution. – Oded Dec 13 '16 at 19:04
  • 11
    Note: you can get the issue to reproduce again after initially clearing it (by "cold-starting" as you described it) by using "Open" from the app's Google Play page, *even if you installed the APK it via Android Studio*. I found this very useful for verifying the fix worked. – Oded Dec 13 '16 at 19:11
  • Nice explanation ! – karanatwal.github.io Feb 07 '17 at 09:37
  • Thanks for this explanation :) – AndroidEnthusiast Apr 25 '17 at 15:30
  • 2
    This happens with a lot of the apps. Google Photos being a major one that I tested. – Raghubansh Mani Sep 22 '17 at 08:16
  • Just pointing out that this doesn't appear to work on the Pixel XL (9.0.0) – behelit Jan 21 '19 at 03:20
  • EDIT: Sorry, this is related to manifest singleInstance usage – behelit Jan 21 '19 at 03:28
  • Possible duplicate or very similar: https://stackoverflow.com/questions/4341600/how-to-prevent-multiple-instances-of-an-activity-when-it-is-launched-with-differ – Mr-IDE Jul 18 '19 at 14:16
  • This worked great with a Xamarin Forms project where it wasn't resuming the app when launched from the home screen. It ran the OnStart code causing problems, after adding this to my SplashActivity it runs the OnResume xamarin code, perfecto! – jmichas Aug 25 '21 at 21:32
22

Aha! (tldr; See the statements in bold at the bottom)

I've found the problem... I think.

So, I'll start off with a supposition. When you press the launcher, it either starts the default Activity or, if a Task started by a previous launch is open, it brings it to the front. Put another way - If at any stage in your navigation you create a new Task and finish the old one, the launcher will now no longer resume your app.

If that supposition is true, I'm pretty sure that should be a bug, given that each Task is in the same process and is just as valid a resume candidate as the first one created?

My problem then, was fixed by removing these flags from a couple of Intents:

i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK );

While it's quite obvious the FLAG_ACTIVITY_NEW_TASK creates a new Task, I didn't appreciate that the above supposition was in effect. I did consider this a culprit and removed it to test and I was still having a problem so I dismissed it. However, I still had the below conditions:

i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)

My splash screen was starting the "main" Activity in my app using the above flag. Afterall, If I had "restart" my app and the Activity was still running, I would much rather preserve it's state information.

You'll notice in the documentation it makes no mention of starting a new Task:

If set, and the activity being launched is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it will be closed and this Intent will be delivered to the (now on top) old activity as a new Intent.

For example, consider a task consisting of the activities: A, B, C, D. If D calls startActivity() with an Intent that resolves to the component of activity B, then C and D will be finished and B receive the given Intent, resulting in the stack now being: A, B.

The currently running instance of activity B in the above example will either receive the new intent you are starting here in its onNewIntent() method, or be itself finished and restarted with the new intent. If it has declared its launch mode to be "multiple" (the default) and you have not set FLAG_ACTIVITY_SINGLE_TOP in the same intent, then it will be finished and re-created; for all other launch modes or if FLAG_ACTIVITY_SINGLE_TOP is set then this Intent will be delivered to the current instance's onNewIntent().

This launch mode can also be used to good effect in conjunction with FLAG_ACTIVITY_NEW_TASK: if used to start the root activity of a task, it will bring any currently running instance of that task to the foreground, and then clear it to its root state. This is especially useful, for example, when launching an activity from the notification manager.

So, I had the situation as described below:

  • A launched B with FLAG_ACTIVITY_CLEAR_TOP, A finishes.
  • B wishes to restart a service so sends the user to A which has the service restart logic and UI (No flags).
  • A launches B with FLAG_ACTIVITY_CLEAR_TOP, A finishes.

At this stage the second FLAG_ACTIVITY_CLEAR_TOP flag is restarting B which is in the task stack. I'm assuming this must destroy the Task and start a new one, causing my problem, which is a very difficult situation to spot if you ask me!

So, if all of my supposition are correct:

  • The Launcher only resumes the initially created Task
  • FLAG_ACTIVITY_CLEAR_TOP will, if it restarts the only remaining Activity, also recreate a new Task
Graeme
  • 25,714
  • 24
  • 124
  • 186
  • FLAG_ACTIVITY_CLEAR_TOP does not create a new task or restart the Activity you are trying to start if it's the only remaining Activity. "If set, and the activity being launched is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it will be closed and this Intent will be delivered to the (now on top) old activity as a new Intent." – starkej2 Apr 22 '14 at 12:55
  • 2
    I realise it's not meant to - but through trial and error this happens to be the case in my instance. Removing these flags fixes the problem. – Graeme Apr 23 '14 at 09:01
  • This doesn't create a perfect resume on all devices under all conditions. – danny117 Apr 23 '14 at 14:12
  • Removing the flags fixed the issue for me. Thanks – Sealer_05 Aug 01 '17 at 15:43
  • I do have splash screen/main screen scenario but I am not using any flags to transition from splash to main, still the issue is reproducible to me - this this solution is not working to me. – ror May 05 '19 at 04:58
17

I had the same issue on Samsung devices. After searching a lot, none of these answers worked for me. I found that in the AndroidManifest.xml file, launchMode is set to singleInstance (android:launchMode="singleInstance"). Removing the launchMode attribute fixed my issue.

Jon
  • 9,156
  • 9
  • 56
  • 73
Ali
  • 1,857
  • 24
  • 25
  • Indeed, this did the trick for me as well. I found this answer from another SO question to be helpful: https://stackoverflow.com/a/21622266/293280. And this write up of the different types of `launchMode` values: https://inthecheesefactory.com/blog/understand-android-activity-launchmode/en – Joshua Pinter Aug 26 '17 at 04:55
  • This fix worked for me! Added this not in manifest but in activity attribute over the main activity class. – Calin Vlasin Oct 16 '17 at 13:57
  • @CalinVlasin could you show me exactly how you used the launchMode ? where did you place it ? currently i have it like this but its causing the issue: – j2emanue Dec 04 '17 at 03:36
  • This was my problem too. I think this should be used in conjunction with the accepted answer (!isTaskRoot... – behelit Jan 21 '19 at 03:23
6

On my Cat s60, I had enabled "Don't keep activities" in Developer options, disabling this again allowed me to switch apps without loosing state of the apps...

K.Dᴀᴠɪs
  • 9,945
  • 11
  • 33
  • 43
ptp
  • 69
  • 1
  • 1
1

This solution worked for me:

    @Override
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            Intent startMain = new Intent(Intent.ACTION_MAIN);
            startMain.addCategory(Intent.CATEGORY_HOME);
            startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(startMain);
            return false;
        }
        else
            return super.onKeyUp(keyCode, event);
    }

credit: I need to minimize the android application on back button click

may not work on all devices, but successfully creates home button behavior when back button is pressed, thus stopping the activity rather than finishing it.

Russell Chisholm
  • 645
  • 9
  • 13
  • Interesting trick but doesn't solve the problem as stated. Very useful for other problems / questions though. – Graeme Nov 23 '17 at 15:57
  • 1
    Back button has a specific purpose and users expect back button to do what it is supposed to do. Overriding it in any way is wrong and, in my opinion, highly unprofessional. – Bugs Happen Jul 08 '19 at 06:21
-1

I had the same problem, the cause was:

(Kotlin code, in MainActivity)

override fun onBackPressed() {
    finish()
}

So when navigating to my MainActivity from my LoginActivity I use this:

    val intent = Intent(this, MainActivity::class.java)
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
    startActivity(intent)

When using these flags I dont have to have a onBackPressed() in my MainActivity, it will exit the app naturally on back click. And when pressing the Home button and going back into the app it dosen't restart.

Christer
  • 2,746
  • 3
  • 31
  • 50
-3

Solution for the people who have no idea about programming and experiencing this issue in their android phone. This happens mostly due to upgrade of android version(only my assumption). After upgrade all your apps gets optimized to use less battery. But, this in turn slows down your device.

How to solve

Go to settings>>Apps>>apps settings(look for settings sign anywhere on the screen- it is different on different devices)>>battery optimization(or similar opti[enter image description here][1]on)>> move all apps to 'not optimised' state (have to do 1 by 1 manually -may be allow/disallow in some phones). Your launcher app need to be 'not optimised'(Zen UI launcher in my case - this is the culprit I guess- you could try optimising/Not optimizing and restarting different app if you have time). Now restart your phone. (no need to reset data/safe mode or any trouble)

Try multitasking now. :) Pressing the launcher icon should now results in the current task being resumed. :) Your device will become Don't worry about battery, it will drain anyway.

-8

Priceless to your users. The perfect resume even after sitting weeks in the recently used app list.

It looks like a resume to the user but actually is a full blown start.

Background: The memory used by apps that are in the main activity that haven't started a task is easy to reclaim. The os can simply restart the app with the original bundle passed to onCreate. You can however add to the original bundle in onSaveInstanceState so when your app is restarted by the OS you can restore the instance state and no one is the wiser on whether the app restarted or resumed. Take for example the classic map program. The user moves to a position on the map and then presses the home key. Two weeks later this mapping app is still in the list of recent apps along with facebook, pandora, and candy crush. The OS doesn't just save the name of the app for the recently used apps it also saves the original bundle used to start the app. However the programmer has coded the onSaveInstanceState method so the orignal bundle now contains all the materials and information necessary to construct the app so it looks like it was resumed.

Example: Save the current camera position in onSaveInstanceState just incase the app is unloaded and has to be restarted weeks later from the list of recent apps.

@Override
    public void onSaveInstanceState(Bundle savedInstanceState) {
        super.onSaveInstanceState(savedInstanceState);
        // save the current camera position;
        if (mMap != null) {
            savedInstanceState.putParcelable(CAMERA_POSITION,
                    mMap.getCameraPosition());
        }
    }



@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // get the exact camera position if the app was unloaded.
        if (savedInstanceState != null) {
            // get the current camera position;
            currentCameraPosition = savedInstanceState
                    .getParcelable(CAMERA_POSITION);
        }

Note: you can also use the onRestoreInstanceState method but I find it easier to restore the instance in onCreate.

This is more than likely what is happening in your app. On some devices your app is unloaded to free memory. Yes there are some flags that help but the flags will not pick up every nuance of your app and the flags won't keep you alive for weeks like onSaveInstanceState will. You have to code the perfect two weeks later resume. It will not be an easy task for the complex app but we are behind you and are here to help.

Good Luck

danny117
  • 5,581
  • 1
  • 26
  • 35
  • This is not due to common memory concerns or default "pause state" conditions. I have tried my app across many devices (some with large memory some with lower memory). – Graeme Apr 23 '14 at 09:06
  • This is why you save persistant data in onPauseI have tried my app to resume as far out as two weeks on the phone I use everyday and let me tell you after two weeks the onCreate method gets called and the os passes in the bundle I saved in onSaveSessionState and I use the data in the bundle to make my activity appear exactly as I left it. So it's only been three days since my answer so there is no way you could have completed a two week test. Summary: App can be shut down any time it is in the background. – danny117 Apr 23 '14 at 14:05
  • @danny117 I don't think you have an accurate understand the issue that Graeme is experiencing – starkej2 Apr 23 '14 at 17:49
  • I understand Graeme's issue. On some devices resuming the app calls onCreate. Sounds exactly like my HTC EVO (Gingerbread) which would kill the app just to rotate the screen. Look at the documents it says so the app can be restored in onCreate http://developer.android.com/reference/android/app/Activity.html#onSaveInstanceState%28android.os.Bundle%29 – danny117 Apr 23 '14 at 18:34
  • @danny117 that's correct, but the issue he is having isn't related to a single activity being recreated when the app is resumed (which is expected), but the wrong activity is being started – starkej2 Apr 24 '14 at 00:46
  • @Blacksh33p You have to live with the issue that your app can be killed at any time it's in the background if you don't want to code for it. Restart phone and resume problem goes away is a symptom of onSaveInstanceState not being coded. – danny117 Apr 24 '14 at 01:09
  • 1
    @danny117 onSaveInstanceState is only useful on the Activity level when a specific Activity is being resumed. He is having an app-level issue - "On some devices, pressing the launcher icon results in the current task being resumed, on others it results in the initial launch intent being fired (effectively restarting the app)" – starkej2 Apr 24 '14 at 12:08
  • @blacksh33p Yes exactly. The launcher from the apps list on a device usually is very memory hungry piece of code what with all the little pngs it displays and the large lists of the fancy paging they do. One would expect during execution of this operation the os would call onsaveinstancestate then kill the app. on devices with unfragmented memory such as after a reboot one would expect the app to resume no mater how the app is started. – danny117 Apr 25 '14 at 20:21
  • I don't care about a few down votes. The bundle passed to oncreate you can use it. You populate that bundle in onSaveInstanceState. – danny117 Sep 23 '15 at 22:53
  • All about how good you are at resuming. There is no magic button. Even FB can't get the resume correct their app is a little more complex than what I make but if you save state there is absolutely no reason you can't make the screen look exactly how the user left it. Its not magic its hard work creating a process to save state and reload state that makes a perfect resume. – danny117 Oct 15 '18 at 14:46
  • Eight markdowns on this and today 3/19/20 facebook can do it correctly at least they added a working ….. thingy. I'm not sure if FB is saving state on server or in a string somewhere. You have to roll your own there is no magic setting yet. – danny117 Mar 19 '20 at 18:01