parentView.post(new Runnable() {
public void run() {
// show the popup
}
});
On Wed, Jun 24, 2009 at 4:07 AM,
extrapedestrianextra.pedestr...@gmail.com wrote:
Hello,
My application has floating popup window (PopupWindow) that is
successfully displayed on user click.
When screen orientation is changed, everything is recreated and I want
my Popup to remain visible.
onRestoreInstanceState is called and my Popup function crashes whilst
calling showAtLocation:
View parentView = this.getCurrentFocus();
if(parentView != null) {
mPopup.showAtLocation(parentView, Gravity.BOTTOM, 0, 0);
}
LogCat saying:
06-24 12:51:26.136: ERROR/AndroidRuntime(1123): Caused by:
android.view.WindowManager$BadTokenException: Unable to add window --
token null is not valid; is your activity running?
06-24 12:51:26.136: ERROR/AndroidRuntime(1123): at
android.view.ViewRoot.setView(ViewRoot.java:384)
06-24 12:51:26.136: ERROR/AndroidRuntime(1123): at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
06-24 12:51:26.136: ERROR/AndroidRuntime(1123): at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:90)
06-24 12:51:26.136: ERROR/AndroidRuntime(1123): at
android.widget.PopupWindow.invokePopup(PopupWindow.java:495)
06-24 12:51:26.136: ERROR/AndroidRuntime(1123): at
android.widget.PopupWindow.showAtLocation(PopupWindow.java:393)
My assumption is that Main Activity Window is not yet displayed (not
yet created) so can not display popup.
Where can I show this popup then? How do I catch event when activity
is displayed.
I can start popup again in this new session, but I would like it to be
opened on screen orientation change.
--
Romain Guy
Android framework engineer
romain...@android.com
Note: please don't send private questions to me, as I don't have time
to provide private support. 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 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
-~--~~~~--~~--~--~---