Android life cycle event on dialog

OnPause() is not called in all types of dialogs.

For Example, when an AlertDialog or DialogFragment is used, it will never call OnPause(), since they are a part of the activity.

However, if a dialog appears from System for a permission or some other app shows a Dialog over the activity it will only call OnPause() since a new activity isn't started and only the foreground focus is shifted from the activity to the Dialog Box.

For Example, when we enable Whatsapp to send a message popup, if the popup comes while your activity is running, it will call OnPause() only.

You should try this on your own for better understanding.


Watch out, few of proposed answers are wrong. This old one have most of truth, but not whole truth. And that new one seems to complement my answer (haven't checked by myself).

This is not true that onPause is called after dialog appears. This dialog would have to be written on separate Activity to cause onPause call. But dialogs are usually written on DialogFragment from support library - reference

you should use a DialogFragment as a container for your dialog

Check also: Android: Under what circumstances would a Dialog appearing cause onPause() to be called?