无法在Android中添加窗口 [英] Unable to add window in Android

查看:142
本文介绍了无法在Android中添加窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的dev的控制台,我得到以下错误:

In my dev console, I get the following error:

android.view.WindowManager $ BadTokenException:无法添加窗口 - 令牌android.os.BinderProxy@405126b8无效;是您的活动运行?

这是后续行: alertDialog =新AlertDialog.Builder(Main.this).create();

下面是我的code:

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.splashscreen);

        alertDialog = new AlertDialog.Builder(Main.this).create();

        LoadData();
}

我不没有什么不对的。

I dont no whats wrong.

推荐答案

您正试图在这里使用一个坏的情况下,尽量使用正确的上下文。看到这,

You are trying to use a bad context here, try to use the right context. See this,

<一个href=\"http://tech.shantanugoel.com/2010/07/08/badtokenexception-android-dialog-getapplicationcontext.html\"相对=nofollow>坏令牌异常

这篇关于无法在Android中添加窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆