码迷,mamicode.com
首页 > Windows程序 > 详细

WindowManager$BadTokenException: Unable to add window permission denied for this window type

时间:2016-02-03 09:49:27      阅读:469      评论:0      收藏:0      [点我收藏+]

标签:

10-11 11:47:27.472: E/AndroidRuntime(12804): java.lang.RuntimeException: Unable to start activity ComponentInfo{cn.zhl.classguiding/cn.zhl.classguiding.XueanPdfActivity}: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@2bef0a78 -- permission denied for this window type
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.ActivityThread.access$600(ActivityThread.java:123)
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.os.Handler.dispatchMessage(Handler.java:99)
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.os.Looper.loop(Looper.java:137)
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.ActivityThread.main(ActivityThread.java:4424)
10-11 11:47:27.472: E/AndroidRuntime(12804): at java.lang.reflect.Method.invokeNative(Native Method)
10-11 11:47:27.472: E/AndroidRuntime(12804): at java.lang.reflect.Method.invoke(Method.java:511)
10-11 11:47:27.472: E/AndroidRuntime(12804): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
10-11 11:47:27.472: E/AndroidRuntime(12804): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
10-11 11:47:27.472: E/AndroidRuntime(12804): at dalvik.system.NativeStart.main(Native Method)
10-11 11:47:27.472: E/AndroidRuntime(12804): Caused by: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@2bef0a78 -- permission denied for this window type
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.view.ViewRootImpl.setView(ViewRootImpl.java:537)
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:301)
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.view.Window$LocalWindowManager.addView(Window.java:537)
10-11 11:47:27.472: E/AndroidRuntime(12804): at cn.zhl.classguiding.XueanPdfActivity.createFloatView(XueanPdfActivity.java:1854)
10-11 11:47:27.472: E/AndroidRuntime(12804): at cn.zhl.classguiding.XueanPdfActivity.onCreate(XueanPdfActivity.java:415)
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.Activity.performCreate(Activity.java:4465)
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
10-11 11:47:27.472: E/AndroidRuntime(12804): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
10-11 11:47:27.472: E/AndroidRuntime(12804): ... 11 more

 

 

修改方法:manifest.xml 添加权限

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" /> 

WindowManager$BadTokenException: Unable to add window permission denied for this window type

标签:

原文地址:http://www.cnblogs.com/zgqys1980/p/5178975.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!