Hi, I was looking 2 weeks ago for sending back and home key events when onClick is performed on a ImageButton, I could do that perfectly.
Now, I have a device with no buttons. So, I want to simulate Menu button click. To know what is really happening, I implemented a code in onCreateOptionsMenu that rises a NullPointerException. I got the following stack trace: 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at com.parrot.mediaplayer.app.FidjiMediaPlayer.onCreateOptionsMenu(FidjiMediaPlayer.java: 146) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at android.app.Activity.onCreatePanelMenu(Activity.java:2038) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java: 469) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at com.android.internal.policy.impl.PhoneWindow.onKeyDownPanel(PhoneWindow.java: 745) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at com.android.internal.policy.impl.PhoneWindow.onKeyDown(PhoneWindow.java: 1413) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at com.android.internal.policy.impl.PhoneWindow $DecorView.dispatchKeyEvent(PhoneWindow.java:1862) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java: 2188) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2158) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at android.view.ViewRoot.handleMessage(ViewRoot.java:1490) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at android.os.Handler.dispatchMessage(Handler.java:99) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at android.os.Looper.loop(Looper.java:123) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at android.app.ActivityThread.main(ActivityThread.java:3948) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at java.lang.reflect.Method.invokeNative(Native Method) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at java.lang.reflect.Method.invoke(Method.java:521) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:782) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 02-24 10:44:40.059: ERROR/AndroidRuntime(734): at dalvik.system.NativeStart.main(Native Method) As we can see there is a call to ViewGroup and PhoneWindow. I guess that we don't have access to these 2 classes in standard SDK. So is there some native function to be invoked for example or any method in that we can call from these on the given stack trace ? Or can somebody provide us with an additional jar file that can make our code compilable? second possibility : Is there a way to do this with introspection API (I don't know too much about this API). third possible solution : I found this code is View source : View root = getRootView(); ViewRoot viewRoot = (ViewRoot)root.getParent(); so if we can just compile the code !!! I think that this is very important because many developers are looking for a such solution. And I really need to find a solution :( Somebody can help please ? -- 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

