The problem is your use of launchMode="singleInstance'
. If ActivityA is defined with launchMode="singleInstance"
, then when ActivityA launches ActivityB, ActivityB ends up in a different task. When the user presses the BACK button, both tasks (the one containing ActivityA and the one containing ActivityB) end up in the background. When the user brings the task containing ActivityB
to the foreground, the other task (containing ActivityA) is still in the background.
Your architecture sounds broken. Why are you launching a Dialog-themed Activity if you want it to behave like a Dialog? Why don't you just show a Dialog in ActivityA? Why are you using launchMode="singleInstance"
? In general, this is wrong (unless you are developing a HOME-screen replacement) and it usually created more problems than it solves because most developers don't really understand how it works.
Also, onResume()
is called on ActivityB because it is resumed (ie: it is in the foreground). onResume()
isn't called on ActivityA because that activity isn't in the foreground. Only 1 activity is ever in "resumed state". All other activities are "paused".