Robot class as Android classes

Possible duplicate:
Android API like java.awt.Robot

Are there any other android classes like the Robot class in java, or can we use the Robot class in android?

+3


source to share


2 answers


No, but the equivalent for you might be Instrumentation on Android.

For example, c sendKeyDownUpSync(int key)

to send synchronization up and down events to the currently focused window.



Instrumentation inst = new Instrumentation();
inst.sendKeyDownUpSync(KeyEvent.KEYCODE_MENU);

      

There is also a utility class TouchUtils

for simulating touch events. Although I should point out that the Instrumentation class is actually only used for testing , so it depends on what you want to achieve anyway.

+6


source


If this is for testing, you can look at Robotium, http://code.google.com/p/robotium/ . This is Selenium for Android.



+1


source







All Articles