views:

119

answers:

2

I upgraded my Nexus One a few days ago with 2.2 (Froyo). This morning when I went to use it I saw a Dialog sitting atop the home/launcher screen notifying me that an update was available and that I could choose to upgrade now or later.

My question is, what API mechanisms is this using to show a Dialog (perhaps an AlertDialog) atop the home screen? Having written an Android app, it was my understanding that Dialogs could only be shown atop an Activity, and that a Service cannot show a Dialog (only a Toast).

Is Google perhaps skinning an Activity to look like a Dialog? Is there a new API method available for showing a Dialog without needing an Activity?

+8  A: 

You can theme an activity like the dialog, its been there for a while (i think 1.6, maybe even 1.5)

<activity android:name=".MyActivity" android:theme="@android:style/Theme.Dialog" />

That would produce what I believe you are seeing.

Ryan Conrad
A: 

Check out the NotificationManager object.

From the Common Tasks reference section, "A notification can be anything from a brief pop-up box informing the user of the new information, through displaying a persistent icon in the status bar, to vibrating, playing sounds, or flashing lights to get the user's attention."

J. Farray