Uh, I think the beginning example in the MonkeyRunner documentation is
wrong. The initial snippet is very misleading. Someone should report
that as a bug.

Your code listing doesn't show that you installed the package that
contains the component you want to start. I assume that you either
installed it before you ran MonkeyRunner, or that you left this out of
your listing.

The syntax of the "component" parameter is the same as that for an
Android ComponentName: package_name/class_name. Package_name is the
Android package name of the .apk containing your application. In your
example, assuming that you're using the Note Pad sample app as your
application, it's com.example.android.notepad. Class_name is the name
of a class that Android can start; it's almost always an extension of
android.app.Activity. For the Note Pad sample app, you would probably
use com.example.android.notepad.NotesList.

To ensure you're not doing something wrong, remember to install the
package, then try using this code snippet:

packagename = "com.example.android.notepad"
classname = "com.example.android.notepad.NotesList"
componentname = packagename + "/" + classname
device.StartActivity(component=componentname)



On Jan 6, 12:28 am, "Hakbong Kim haknal...@gmail.com"
<haknal...@gmail.com> wrote:
> I tried to use monkeyrunner.
> A target is Android vmware image.
> I checked that press(), takeSnopshot() and drag() are normally
> executed.
> But, startActivity() is not executed.
>
> The first source code is
>
>      from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
>      device = MonkeyRunner.waitForConnection()
>
> device.startActivity(component='com.example.android.notepad.NotesList')
>
> The second is
> ( I modified a third line referring to a writing of this group )
>
>      from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
>      device = MonkeyRunner.waitForConnection()
>      device.startActivity(component='com.example.android.notepad
> \.NotesList')
>
> In two cases, the result is same
>
> 110106 17:13:42.168:I [main] [com.android.monkeyrunner.MonkeyManager]
> Monkey Command: wake.
> 110106 17:13:42.310:I [main] [com.android.monkeyrunner.MonkeyManager]
> Monkey Command: quit.
>
> I tried using startActivity() with other activities. But, the result
> is same.
> What is right arguments for startActivity() ?

-- 
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

Reply via email to