You don't. Applications aren't allowed to inject events into other
applications.
If you are wanting to do automated testing, you can use the
Instrumentation APIs to write a separate .apk that injects events into
another .apk it is testing, but both of these need to be signed with
the same certificate so you can only test things you have written.
On Sep 22, 7:23 pm, "詹正維" <[EMAIL PROTECTED]> wrote:
> If this is the case, then how do I simulate pressing the hardware keys in
> other screens (for instance, pressing the right key in home screen)?
>
> 2008/9/23 hackbod <[EMAIL PROTECTED]>
>
>
>
> > As it says, one application inject key events in to another
> > application. It would be a huge security hole to allow such things.
>
> > On Sep 22, 1:54 am, Tigers <[EMAIL PROTECTED]> wrote:
> > > How do I simulate a keyevent in the home screen?
> > > I can simulate a keyevent with "windowManager.injectKeyEvent" in my
> > > application, but after I send the KEYCODE_HOME(Go to Home Screen), the
> > > other simulate keyevent can't be sent.
> > > The log is as below, please help me, Thanks.
>
> > > 09-22 08:34:13.911: WARN/WindowManager(51): Permission denied:
> > > injecting key event from pid 301 uid 10016 to window Window{434b0248
> > > com.android.launcher/com.android.launcher.Launcher} owned by uid 10003
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---