MonkeyRunner actually has a small example of doing this in it's own source code:
http://android.git.kernel.org/?p=platform/sdk.git;a=blob;f=monkeyrunner/src/com/android/monkeyrunner/controller/MonkeyController.java;h=ca3195c15ca45735bd971c9c4f56b9e97fe9b94d;hb=HEAD IMonkeyBackend adb = new AdbBackend(); IMonkeyDevice device = adb.waitForConnection(); And you can see the IMonkeyDevice source here: http://android.git.kernel.org/?p=platform/sdk.git;a=blob;f=monkeyrunner/src/com/android/monkeyrunner/core/IMonkeyDevice.java;h=9c06ec49fc291ffe331d20f3472dffb41539024b;hb=HEAD And see that it has a bunch of methods on it like "takeSnapshot", "touch", "drag", etc. Hopefully that's enough to get you started. Bill On Fri, Jun 24, 2011 at 7:27 PM, Karthikeyan R <dba.kart...@gmail.com>wrote: > Hi Bill, > > Thank you so much for sharing the information. > > we wanted to create a automation framework in java having MonkeyRunner > as base. > > Could you give me one small sample using java, it will be really > helpful for us. > > To give you a context we wanted to automated the device as a whole > where we interact with multiple apk's hope our choice of monkey > runner is right for that. > > Thank you in advance. > > Thanks > --Karthik > > On Jun 24, 10:39 am, Bill Napier <nap...@android.com> wrote: > > If you mean from Java on the phone (like as part of an application), then > > the answer is no. > > > > If you mean from Java on a computer, then the answer is yes. You just > need > > to make your java project depend on the MonkeyRunner.jar and you can call > > some of it's internal classes to do what you need. > > > > We're in the middle of changing how the code is structured to make this > even > > easier, but it's not quite ready yet. > > > > > > > > > > > > > > > > On Wed, Jun 22, 2011 at 8:16 PM, Karthik <dba.kart...@gmail.com> wrote: > > > Hi, > > > > > Is it possible to use monkeyrunner from java. > > > > > If yes please let me know the approach. > > > > > Thanks in advance > > > > > Thanks > > > --Karthik > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to > android-developers@googlegroups.com > > > To unsubscribe from this group, send email to > > > android-developers+unsubscr...@googlegroups.com > > > 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 android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en