I found the solution:
there is an excellent post :
http://letsgoustc.spaces.live.com/blog/cns!89AD27DFB5E249BA!488.entry
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);
//instrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_HOME);
}
}).start();
On 15 fév, 10:03, Houcem Berrayana <[email protected]> wrote:
> Hi Rogério,
> Thank you for your help. Actually I'm using full screen mode and I
> can't use the status bar. I'm using a very special device so that I
> really need to know how to send key events programmatically. Do I have
> access to IWindowManager for example (I can't see it in the SDK)? I
> read so many examples that used this class to solve tis problem.
> example here
> :http://www.anddev.org/throwing-simulating_keystrokes_programatically-...
>
> Best Regards.
>
> On 12 fév, 20:10, Rogério de Souza Moraes <[email protected]>
> wrote:
>
>
>
> > Hi Houcem,
>
> > take a look at the code of android-x86 that implaments a way to use MENU,
> > BACK and HOME buttons in a device with just touchscreen. i if the name of
> > the file that implements tihs is touchable.java
>
> >http://www.android-x86.org/documents/touch-only-device-howto
>
> > Regards,
>
> > Rogerio
>
> > 2010/2/12 Houcem Berrayana <[email protected]>
>
> > > Hi all,
>
> > > I want to simulate Home and Back buttons. I tried to see how to
> > > dispatch a key event but I didn't knew exactly how to do ??
> > > I found some examples using IWindowManager. but I haven't found this
> > > class in the SDK. Is there any other way to send key events ?
> > > Thanks by advance and excuse me for my horrible English.
>
> > > --
> > > 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]<android-developers%2Bunsubs
> > > [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