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?