Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8360339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:26:13+00:00 2026-06-09T11:26:13+00:00

In my project i am trying to open the optionsMenu programmatically without a click

  • 0

In my project i am trying to open the optionsMenu programmatically without a click on the menu key from the user. I have tried openOptionsMenu() but it gives me an error like this android.view.WindowManager$BadTokenException: Unable to add window — .. why it is… what is the solution for this…

08-13 14:53:02.687: E/AndroidRuntime(1213): FATAL EXCEPTION: main
08-13 14:53:02.687: E/AndroidRuntime(1213): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.veytila.candideye/com.veytila.candideye.MainActivity}: android.view.WindowManager$BadTokenException: Unable to add window — token null is not valid; is your activity running?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:26:16+00:00Added an answer on June 9, 2026 at 11:26 am

    I believe you are doing this in Oncreate or onResume. You will have to call this api only after the window of the activity has been initialized. One way is to post a delayed runnable in your onresume on to ui thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use an open-source project. Both the latest official (from a *.tar.gz
I'm trying to write a multi-file patch for an open-source project, but the master
I'm trying to open a project file in the main editor of kdevelop, but
I'm trying to open MVC project using VS2010 . I'm opening this project from
I'm trying to open my rails project into mvim (macvim) using mvim . but
I am trying to open an MVC 3 project on my system but I
I'm trying to open an open source project and I'm getting an error when
I am using XCode 4.3.2 and trying to open an already existing project based
I am trying to use different open source apps in my project. Problem is
I am trying to modify an open source Forum called YetAnotherForum.net in the project

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.