btw Dianne,
In the docs (http://developer.android.com/guide/topics/ui/dialogs.html ),
they do say that we may create a dialog outside onCreateDialog method which
is not owned by/attached to an activity.

However, we may assign an owner by calling
setOwnerActivity(Activity)<http://developer.android.com/reference/android/app/Dialog.html#setOwnerActivity(android.app.Activity)>
method.
I was referring to this in option # 2.

I think the docs meant the explicit call to new Dialog in that section?


On Tue, Oct 6, 2009 at 11:46 AM, Android Development <[email protected]>wrote:

> Thanks for the answer Dianne.
> Yes, i meant calling new Dialog manually in option 2. I will save the
> instance state and go about it that way.
>
>
> On Tue, Oct 6, 2009 at 11:39 AM, Dianne Hackborn <[email protected]>wrote:
>
>> I'm not sure what you mean by option 2 -- an application should pretty
>> much never create a dialog that is not owned by an activity.  It needs to be
>> associated with an owning activity to be properly Z-ordered and otherwise
>> managed with other apps/activities.
>>
>> If you are talking about the difference between using onCreateDialog() vs.
>> manually calling new Dialog() to display a dialog on the activity, well in
>> the second case your activity just need to take care of all of the
>> management of the dialog without really much help from the system: in
>> particular, make sure that you properly save and restore its state as your
>> activity's onSaveInstanceState() is called and you later receive that state
>> in onCreate().
>>
>>
>> On Mon, Oct 5, 2009 at 10:34 PM, Android Development <[email protected]
>> > wrote:
>>
>>> Hello,
>>> I have a requirement for showing dialogs in my application. Alert dialogs
>>> fulfill by needs for now.
>>>
>>> I wish to discuss..and conceptually understand in the process, the exact
>>> relationship between the Activity that is being displayed at a given point
>>> of time...and the Dialog that pops up on the screen.
>>>
>>> The Android documentation provides us with 2 options regarding this:
>>>
>>> 1. To bind the dialog with the activity, making the current activity the
>>> 'owner' of this dialog for managing its state. In this case, we create the
>>> Dialog in the onCreateDialog callback.
>>>
>>> 2. To create a dialog 'outside' of the activity's context, where the
>>> activity is no longer the owner of this dialog.
>>>
>>> I wish to understand what extra liabilities will the developer face if I
>>> follow Option # 2?
>>>
>>> My requirement is for option 2 above. I wish to display a dialog for an
>>> incoming call. However, the user may be at any 'page' (activity) of my
>>> application when the call is received. Hence, i cannot predict the activity
>>> that would be displaying at that instant, when i need to display the dialog
>>> for the incoming call.
>>>
>>> My questions are as follows:
>>>
>>> a) Who manages the Dialog state in case of Option 2 and how ?
>>>
>>> b) What if the user flips the screen when the dialog is being displayed
>>> by following Option 2 above ?
>>>
>>> c) Can any user defined object (Eg: CallManager in my case) be assigned
>>> the owner of the Dialog being displayed ?
>>>
>>> Any insight/answers are very much appreciated....
>>>
>>> Thanks for the help
>>>
>>> Best Regards
>>>
>>> AD.
>>>
>>>
>>>
>>
>>
>> --
>> Dianne Hackborn
>> Android framework engineer
>> [email protected]
>>
>> Note: please don't send private questions to me, as I don't have time to
>> provide private support, and so won't reply to such e-mails.  All such
>> questions should be posted on public forums, where I and others can see and
>> answer them.
>>
>>
>> >>
>>
>

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

Reply via email to