Hi saru, I posted the same question last Friday. I found the solution which consists on dispatching the event using the event dispatcher of the activity. If you would like to read some advanced technical details about event processing you can read this excellent post: http://letsgoustc.spaces.live.com/blog/cns!89AD27DFB5E249BA!488.entry
public void onClick(View v) { new Thread(new Runnable() { @Override public void run() { KeyEvent backEvtDown = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK); KeyEvent backEvtUp = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK); mActivity.dispatchKeyEvent(backEvtDown); mActivity.dispatchKeyEvent(backEvtUp); } }).start(); } Best Regards, On 15 fév, 10:28, saru <sarucs...@gmail.com> wrote: > hey, Please tell me > abouthttp://davanum.wordpress.com/2007/12/19/android-simulate-key-strokes/. > How they did it > > On Feb 14, 7:17 pm, Mark Murphy <mmur...@commonsware.com> wrote: > > > > > saru wrote: > > > Hey i want to write a program in android to press menu button or end > > > button or answer button automatically. > > > You can't, sorry. > > > -- > > Mark Murphy (a Commons > > Guy)http://commonsware.com|http://twitter.com/commonsguy > > > Android Consulting/App Development:http://commonsware.com/consulting -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en