I read the android developer guide and some articles in internet, I'm still confusing about the singleTask
launchmode
. Lets take an example:
User launch the App1, android starts a new task. Assume the App1 creates activities in follow order:
ActivityA -> ActivityB -> ActivityC
That's how task1 looks like.
Then user click the home buttom and choose to launch App2, so task1 goes in background and android start a new task: task2, user does something:
ActivityD -> ActivityE
now lets say ActivityE
try to start ActivityB
, and ActivityB
has the launchmode singleTask
.
What I understand is that task1 comes to frontend again and task2 goes to background. And task1 looks now like this:
ActivityA -> ActivityB
Which means:
The ActivityC
will be removed from task1 and ActivityB becomes to the top Activity.
If user now click on "Back" button, he will come to ActivityA
of task1 instead of back to ActivityE
of task2
Am I right?
Thanks
You sound right.
Why don't you test it.
There is also this app that can help explain launch mode:
https://play.google.com/store/apps/details?id=com.novoda.demos.activitylaunchmode
Sources are at https://github.com/gnorsilva/Activities-LaunchMode-demo