OSDN Git Service

DOC CHANGE: Fix bug 3448489 - Monkeyrunner example
authorJoe Malin <jmalin@google.com>
Mon, 14 Feb 2011 18:29:12 +0000 (10:29 -0800)
committerJoe Malin <jmalin@google.com>
Mon, 14 Feb 2011 18:29:12 +0000 (10:29 -0800)
Change-Id: Ib997e9b0ef27a071c26774d139f19610404cdfbc

docs/html/guide/developing/tools/monkeyrunner_concepts.jd

index d648b93..658ff75 100644 (file)
@@ -110,8 +110,17 @@ device = MonkeyRunner.waitForConnection()
 # to see if the installation worked.
 device.installPackage('myproject/bin/MyApplication.apk')
 
-# Runs an activity in the application
-device.startActivity(component='com.example.android.myapplication.MainActivity')
+# sets a variable with the package's internal name
+package = 'com.example.android.myapplication'
+
+# sets a variable with the name of an Activity in the package
+activity = 'com.example.android.myapplication.MainActivity'
+
+# sets the name of the component to start
+runComponent = package + '/' + activity
+
+# Runs the component
+device.startActivity(component=runComponent)
 
 # Presses the Menu button
 device.press('KEYCODE_MENU','DOWN_AND_UP')