开发者

Launch AlertDialog not from an Activity

开发者 https://www.devze.com 2023-02-09 21:59 出处:网络
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 dia

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号