3

Possible Duplicate:
Android API like java.awt.Robot

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

Community
  • 1
  • 1
Rohit
  • 83
  • 1
  • 2
  • 8

2 Answers2

6

No, but an equivalent for you could be Instrumentation on Android.

For instance with sendKeyDownUpSync(int key) for sending an up and down key event sync to the currently focused window.

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

There is also the utility class TouchUtils to simulate touch events. Although I have to note, that the Instrumentation class is actually only used for testing, so it depends on what you want to achieve anyway.

Konrad Reiche
  • 27,743
  • 15
  • 106
  • 143
1

If it's for testing you can look up Robotium, http://code.google.com/p/robotium/. It's Selenium for Android.

dutt
  • 7,909
  • 11
  • 52
  • 85