I am trying to launch an alert dialog when not in a class that extends activity, but I am 开发者_运维问答on the GUI thread. I have access to my applications context and attempt to launch the alert dialog with that but get an error:
02-12 00:48:07.412: ERROR/AndroidRuntime(1322): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
Does anybody know what I am doing wrong on this one?
You cannot launch a dialog except via an activity, sorry.
You are welcome to create an activity that uses Theme.Dialog
or something to look a bit like a dialog, if you wish.
精彩评论