I have an app that is very hierarchical (activities are similar to League > Team > Position > Player) and so I've made each activity singleTop
in order to keep navigation sensible and to prevent duplicate instances.
Now I'm making my second app and I've seen it suggested to declare my application to be singleTask
to prevent duplicate instances. Could someone help explain the advantages of each approach?
My new app is just an activity with 3 fragments and then I'll probably add a settings activity and maybe a FAQ.
EDIT: I just realized that singleTask
is NOT preventing duplicate instances of my app, as I had thought. Now looking for the right way to handle this...
I think your definition of singleTop and singleTask is a little off. SingleTop could produce a duplicate instance. Lets use your example, League > Team > Position > Player. If there is a button in the player screen that will take you to the league screen, it will become League > Team > Position > Player > League.
Whereas singleTask guarantees that only one instance of the activity can exist.