caused By:android.view.windowmanager$badtokenexception:unable to add window--token null was not for a application

Source: Internet
Author: User

The following error message appears when you start a dialog on a broadcast: caused By:android.view.windowmanager$badtokenexception:unable to add window--token null is no T for an application

Dialog.getwindow (). SetType (WindowManager.LayoutParams.TYPE_SYSTEM_ALERT) is added to the code, the error message is not removed,

Now add the system permissions in the Manifest.xml file and add:

Allows the app to use Type_system_alert to open the window and display the window at the top of other apps

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

Permissions, the dialog box can be up.

caused By:android.view.windowmanager$badtokenexception:unable to add window--token null was not for a application

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.