That's exactly the difference between onPause
and onStop
events of the activity as described in the Activity class documentation.
If I understand you correctly, what you want to do is call finish()
from your activity onStop
to terminate it.
See the attached image of the Activity Lifecycle Demo App. This is how it looks like when Activity B is launched from Activity A.
The order of events is from bottom to top so you can see that Activity A onStop
is called after Activity B onResume
was already called.
In case a dialog is shown your activity is dimmed in the background and only onPause
is called.