From the documentation:
public boolean moveTaskToBack (boolean nonRoot)
Move the task containing this activity to the back of the activity stack. The activity's order within the task is unchanged.
What exactly does "Move the task containing this activity to the back of the activity stack" mean? I know that each task is a stack of activities, but according the the above sentence, it seems there is also a global stack of tasks as well?
When I try this method out, the current activity moves to the background, and the behaviour seems very much like when clicking the Home button (e.g. the activity is not destroyed and can be resumed later). Is there any difference between calling this function and pressing the Home button?
There is not a "global stack of tasks." There's a global stack of activities, which can be from one app or from multiple. Let's say you have an app where you can click a link, bringing you to your browser. If the browser then calls a moveTaskToBack() method, then the original app activity will open, with the previous activities on the backstack still in place.
Now imagine instead of calling the moveTaskToBack() method, the user presses the Home button. Now, pressing Back on your phone will not take you back to the original app. You'll just stay on the home screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With