On Fri, Dec 4, 2009 at 12:31 PM, bizack <[email protected]> wrote:

> I would agree with you.  I think the problem (or misunderstanding on
> my behalf) is that trying to call getWindowManager().addView outside
> of onCreate orphans the Window (getWindow() returns null).
>

No it definitely doesn't.  For example, dialogs and pop-up windows all use
this, and they work fine if called in onCreate or elsewhere.  You must be
doing something else to cause getWindow() to return null...  though I
honestly can't imagine what, since mWindow (which Activity.getWindow()
returns) is set in activity.attach() (which is called before onCreate()),
and never set to null after that.

Also I would strongly strongly recommend using Dialog instead of directly
adding a view to the window manager, especially if this window is going to
receive key events, because Dialog implements a lot of the common
framework-side higher-level behavior for windows...  such as, for example,
default key event handling.

-- 
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