For a long press you should make the thread sleeping for a while until the recent apps appears. I haven't yet tested the menu, and phone calls buttons.
On 15 fév, 11:47, Sean Hodges <[email protected]> wrote: > The back button is fine, but you can't simulate the exact behaviour of > the home button. For example, bringing up the recent apps menu when > long pressing it. > > Good work-around for some scenarios though. > > On Mon, Feb 15, 2010 at 10:36 AM, Houcem Berrayana > > > > <[email protected]> wrote: > > I had exactelly the same problem as you. Using that piece of code I > > could simulate Home and Back key events. > > Regards, > > > On 15 fév, 10:52, Sean Hodges <[email protected]> wrote: > >> Well, the two things I can tell you about it is: > > >> 1) They show exactly how they did it by giving you the source code. > > >> 2) They don't show you how to programatically send "Menu" or "End > >> Call" button presses, because it is not possible to simulate those > >> buttons (as Mark stated already). > > >> Those hardware buttons are restricted to application developers, you > >> can't simulate them. You also can't end *any* active call from your > >> app, which is what the "End Call" button obviously does. The one thing > >> you can do is make your options menu appear without requiring the menu > >> button (I've not tested this): > > >>http://groups.google.com/group/android-developers/browse_thread/threa... > > >> But this does not involve simulating key presses. > > >> On Mon, Feb 15, 2010 at 9:28 AM, saru <[email protected]> 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 <[email protected]> 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 [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 > > > -- > > 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 -- 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

