showDialog and AlertDialog.Builder are orthogonal (independent).

You can create a managed dialog with Builder (by using it inside
onCreateDialog) or an unmanaged dialog using new Dialog(), etc.

Now with this being said, your code below creates an unmanaged dialog,
and if you want it to persist through activity being recreated, you've
got to write code to do it yourself.

-- Kostya

02.02.2011 16:07, alligator пишет:
> There are at least 2 ways to display a dialog in an activity.
> One is to call showDialog, which is managed by the class Activiy. In
> this case, to understand the dialog is restored by
> onSaveInstanceState / onRestoreInstanceState.
> I believed u are talking about this scenrio.
>
> The other is to AlertDialog, with codes like:
>               Dialog dialog=new AlertDialog.Builder(mctx)
>               .setTitle("about")
>               .setMessage("...")
>               .setPositiveButton("OK", new DialogInterface.OnClickListener()
> {
>                       public void onClick(DialogInterface dialog, int 
> whichButton)
> {
>                               return;
>                       }
>               })
>               .create();
>               dialog.show();
> What I am talking about is this scenario.
>
>
> On 2月1日, 下午10时26分, Kostya Vasilyev <kmans...@gmail.com> wrote:
>> I'm not a "GUI guru", but I'll try to answer :)
>>
>> Dialogs are managed by Activity class inside the Android framework.
>>
>> If a dialog is shown with showDialog(id, [bundle]), it's remembered by
>> Activity as being visble, and will be saved by Activity at the same time
>> as your onSaveInstanceState / onRestoreInstanceState are called (if you
>> have those overrides).
>>
>> This means that managed dialogs survive orientation changes, as well as
>> the activity being destroyed and re-created when the user comes back to
>> it (such as with the list of recent applications, called up by [Home]
>> long press).
>>
>> http://developer.android.com/guide/topics/ui/dialogs.html
>>
>> AFAIK, there is no way to check whether a a given dialog is on the
>> screen, although the framework certainly knows this.
>>
>> -- Kostya
>>
>> 01.02.2011 16:31, Jian Chen пишет:
>>
>>> A problem confused me for a little while, which is about dialog
>>> window and activity。
>>> In a normal activity,an alert dialog is called to be shown on top of
>>> this activity,and HOME key is pressed to go to HOME screen。
>>> Then HOME key is long pressed to go back to this activity。
>>> Surprisingly, the alert dialog is restored.
>>> Is this job done by activity manager?
>>> A second question is, in some scenarios the activity does not hold the
>>> reference, is there a way to index its top window(for example, dialog
>>> window) from this activity's API?
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to android-developers@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> android-developers+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en
>> --
>> Kostya Vasilyev -- WiFi Manager + pretty widget 
>> --http://kmansoft.wordpress.com


-- 
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to