In my project, I try to open optionsMenu programmatically without clicking on the menu button from the user. I tried openOptionsMenu () , but it gives me an error like this android.view.WindowManager $ BadTokenException: cannot add window - .. why is this ... 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: Cannot start Activity ComponentInfo {com. veytila.candideye / com.veytila.candideye.MainActivity}: android.view.WindowManager $ BadTokenException: Unable to add window zero token; Does your activity work?
source
share