Skip to content Skip to sidebar Skip to footer

Unexpected Behavior When Launching A Dialog-style Activity

I observed from WhatsApp such behaviors: when a new message arrives, WhatsApp will launch a dialog-style activity and such a activity could be cancelled or confirmed by the user. T

Solution 1:

Your application maintains an activity stack. So your main activity A and your dialog activity B is represented as A->B in your app's activity stack.

When your app is launched and put to background. When your dialog activity is invoked and brought to the foreground, your main activity A is still live and thus will be shown as well. Maybe you can call "finish()" in A after startActivity(dialogActivity) to make sure A is finished and goes away.

Post a Comment for "Unexpected Behavior When Launching A Dialog-style Activity"