You can use the startActivities method to start a full backup of actions in one go.
startActivities( new Intent[] { new Intent("my.intent.FOO_INTENT"), new Intent("my.intent.BAR_INTENT"), new Intent("my.intent.BAZ_INTENT") });
In this example, a Baz instance is created and the current operation is performed.
If Baz ends, a Bar instance is created and the current operation is performed.
If Bar ends, an instance of Foo is created and the current activity is executed.
This method was introduced at API level 16, but is available in the v4 support library through the ContextCompat class:
ContextCompat.startActivities(context, new Intent[] { new Intent("my.intent.FOO_INTENT"), new Intent("my.intent.BAR_INTENT"), new Intent("my.intent.BAZ_INTENT") });
source share