I've been looking through the API documentation, and noticed starting with API level 16 the Context class includes the following method:
public abstract void startActivities (Intent[] intents)
I've been Googling around in attempts to stave my curiosity through an example of it's use in application code, a question, or article, but I haven't come across anything as of yet. If someone has already asked a similar question, please let me know.
Anyways, I'm curious as to when this should/could be used in application code, and what (if any) benefits of doing so would be? I've personally never seen this method used, and I fail to grasp it's utility. Any feedback will be appreciated.
Never used it myself, but I think it is useful when you want to recreate your activity stack, when starting a new fresh task. For example when your application gets launched from a notification, the system won't use an existing task for your application but instead create a new task with your application on it by default. In this case you may want to start on a certain position of your activity stack, and with this method you could start all your activities with one call
It's rarely used in application code. I was going to say never, but I'm not that sure ;)
However, it can be used to create a synthetic back stack, when starting a new Task. You want to have a ready-made back stack, so that the back key navigates "hierarchically" inside this task.
Curiously, it's better explained in the documentation of
ContextCompat
than inContext
itself.I have used the method. In some specific sutiation, I clear the task stack when I create a new activity .But when I back to the activity which was already cleared in the task stack, I used the
startActivities()
to create a aritificial task stack.