I am trying to make a PopupWindow show straight away when an activity
has started.

when calling
public void showAtLocation (View parent, int gravity, int x, int y)

 I get the exception
 ERROR/AndroidRuntime(2500): Caused by: android.view.WindowManager
$BadTokenException: Unable to add window -- token null is not valid;
is your activity running?

At the moment I am calling from onCreate, but when calling from
onStart or onResume it still gives the same error.

The activity api says the activity is supposed to be running after
onResume is called. Where is the best place to load up the PopupWindow
if it needs to be done straight away?


At the moment It looks like Activity.onWindowFocusChanged() is the
best place.

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