Hi skink, I tryied first of running in another thread diferent than UI thread but it didn't work also.
this is my stacktrace: 02-24 18:09:10.309: ERROR/AndroidRuntime(22919): Uncaught handler: thread main exiting due to uncaught exception 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): java.lang.NullPointerException 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): at com.android.internal.policy.impl.PhoneWindow.openPanel(PhoneWindow.java: 553) 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): at com.android.internal.policy.impl.PhoneWindow.openPanel(PhoneWindow.java: 542) 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): at android.app.Activity.openOptionsMenu(Activity.java:2220) 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): at com.intl.mediaplayer.app.view.MediaPlayerControlsManager $7$1.run(MediaPlayerControlsManager.java:152) 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): at android.os.Handler.handleCallback(Handler.java:587) 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): at android.os.Handler.dispatchMessage(Handler.java:92) 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): at android.os.Looper.loop(Looper.java:123) 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): at android.app.ActivityThread.main(ActivityThread.java:3948) 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): at java.lang.reflect.Method.invokeNative(Native Method) 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): at java.lang.reflect.Method.invoke(Method.java:521) 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:782) 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 02-24 18:09:10.328: ERROR/AndroidRuntime(22919): at dalvik.system.NativeStart.main(Native Method) On 24 fév, 21:50, skink <[email protected]> wrote: > On Feb 24, 4:15 pm, Houcem Berrayana <[email protected]> > wrote: > > > > > > > This is my little code : > > > options.setOnClickListener(new OnClickListener() { > > > @Override > > public void onClick(View v) { > > mActivity.runOnUiThread(new Runnable() { > > > @Override > > public void run() { > > mActivity.openOptionsMenu(); > > } > > }); > > > } > > }); > > > I was using the android standard emulator.. when pressing the physical > > button it show the menu. However when I do it directly for the first > > time programmaticaly it rises an exception ! > > without stacktrace its hard to say anything > > i was calling openOptionsMenu(); and it worked just fine > > and i dont understand why you need to runOnUiThread inside onClick - > its weird > > pskink -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

