I have this Android code:
Intent launchIntent = packageManager.getLaunchIntentForPackage(context.getPackageName());
cpa.startMainActivity(launchIntent.getComponent(), user);
// try to move down
if (dialogDismisser != null) {
dialogDismisser.run();
}
How can it be that the dialogDismisser
is called even after cpa.startMainActivity
?
Intent redirection is promised to only happen sometime in the future?
Starting an activity does not kill your thread. Your thread will continue to run, finish the function, and any other functions until its back at its looper or ends the thread. If you want to not execute the remaining code, you need to return.
The new Activity will start the next time the main thread gets a chance to look at its messages. So if this is called on a thread, the next context switch. If this is run on the main thread, then when it returns to the looper, after processing any other pending messages. (Assuming your starting an Activity in your own app. If not, it happens the next time the OS context switches to that app's main thread and that thread reaches the looper).