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


    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" /> 

  • 相关阅读:
    [USACO08OCT]Watering Hole
    [USACO08OCT]Watering Hole
    Mininet系列实验(七):Mininet脚本实现控制交换机行为
    IIS与TOMCAT协同工作---在IIS下运行JSP页面
    代码与编程题
    JAVA面试题集
    Jquery测试题
    Java---SSH(MVC)面试题
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
  • 原文地址:https://www.cnblogs.com/zgqys1980/p/5178975.html
Copyright © 2020-2023  润新知