Thursday, May 21, 2015

Managing Activity in Task Stacks

Android support multi-tasking view Tasks. And the most important element of a Task is a Back Stack of Activity. See this Android guide for an introduction.

The difficulty of mastering Android Tasks, so as to manipulate them and to control how a new Activity is launched into them, lies in the plethora of options and flags that affect how a new Activity is launched and how it interacts with existing tasks. The key to success is a good understanding of those flags. A good grasp of these concept and mechanism opens up a whole new world of possibilities that can make your app more usable and intuitive, rather than always launching an Activity in the standard way. For me, I found these following articles very useful:

The first article is newer and also more comprehensive in terms of corner cases and pitfalls.

Also, dumping the current Task stacks is very handy for debugging. To do so, use the following command:
adb shell dumpsys activity activities

No comments:

Post a Comment