onPause


#1

Hi,

I am a bit confused about when is onPause() called but not onStop(). All the documentation says the former is called when the activity is partially visible, and the latter when completely invisible/covered. I am not able to visualize a real example. Android developers doc says “when a semi-transparent activity opens (such as one in the style of a dialog), the previous activity pauses.” (http://developer.android.com/training/basics/activity-lifecycle/pausing.html).

I created a small dialog in one of my activities and logged the life cycle events. But when the dialog shows up, my log does not say “OnPause()”! Can you please clarify?

Thanks.


#2

There’s a real example of this much later in the book - in chapter 28, search. On Gingerbread devices, the Search activity that is started up is a dialog activity - an activity that start up in front of your activity, but has a transparent background. (This is different from the DialogFragments used in CriminalIntent, which stay inside the same activity)