在我的Java应用程序中,我有这个code
@覆盖
公共无效onAttachedToWindow()
{
。this.getWindow()的setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
super.onAttachedToWindow();
}
当我建立它的的Android 2.3(10级)编译和工作正常。但是,当我建立它的的Android 4.0(等级15)它编译并给我崩溃在运行时以下错误
07-16 14:00:03.090:E / AndroidRuntime(29487):致命异常:主要
07-16 14:00:03.090:E / AndroidRuntime(29487):java.lang.IllegalArgumentException:如果窗口被加入后窗口类型不能改变。
在我评论这条线,并建立它工作正常,并没有任何问题。
// this.getWindow()的setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
所以我没有得到为什么这happning和最新此code手段?
编辑: 一些参考的位置
when我对我的phone.The版本上运行的应用程序的是Android 4.0.3
toddler在Android 安全应用
解决方案 @覆盖
公共无效onAttachedToWindow()
{
。this.getWindow()的setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
super.onAttachedToWindow();
}
用于停用home键的机器人,但
本安全漏洞已被固定在较新版本的Android ,这样就不会在ICS和果冻豆的工作... !!
In my java application i have this code
@Override
public void onAttachedToWindow()
{
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
super.onAttachedToWindow();
}
when i build it for android 2.3 (level 10) it compiles and works fine. But when i build it for android 4.0 (level 15) it compiles and gives me crash at run time and following error
07-16 14:00:03.090: E/AndroidRuntime(29487): FATAL EXCEPTION: main
07-16 14:00:03.090: E/AndroidRuntime(29487): java.lang.IllegalArgumentException: Window type can not be changed after the window is added.
when i comment this line and build it works fine and no issue..
//this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
so i am not getting why this happning and whats this code means?
Edit : some reference are here
when I run app on my phone.The version is android 4.0.3
toddler safe app on android
解决方案@Override
public void onAttachedToWindow()
{
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
super.onAttachedToWindow();
}
is used to disable home button in android but
this security flaw has been fixed in newer versions of Android so it will not work in ICS and jelly bean...!!
上一篇:...你宣布你的AndroidManifest.xml本次活动你的、Andr、xml、oidManifest
下一篇:Android的JSON错误"预期BEGIN_OBJECT但BEGIN_ARRAY在行1列2英寸在行、错误、JSON、Android