Dear friends,
I would like to create a launch configuration, to run any activity with
arguments, for quick manually interactive testing.
I have one Android Application with many activities. Some of them are
chained in a wizard, each activity is a step, so they are launched from one
another, with put extras in the intent as arguments for the next step. I
would like to quickly reach the read marked step marked in the flow below,
in other words I would like to launch directly an activity towards the end
of my wizard, without having to go through all the previous wizard steps.
[extras] [...] [...] * [extras]
* [...] [...]
Activity_1 --------> Activity_2 --> [...] --> Activity_6* ---------->
Activity_7 *--> [...] --> Activity_9
I managed to create a run configuration that launches the activity I want.
But I can't find how to define the extras in the run config, and without
arguments running that activity doesn't make sense.
To create a run configuration for a different activity I added a LAUNCHER
intent-filter in AndroidManifert.xml:
<activity
android:name=".Activity_7"
android:label="@string/label_activity_7" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.hello.activity_6"
/>
<intent-filter>
<action
android:name="android.intent.action.WHATEVER_ELSE_THAN_MAIN_TO_AVOID_ICON_IN_LAUNCHER"
/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I am following two paths that I think might achieve what I want - but so
far to no avail:
*1. Trying to use ActivityManager in the ADB shell to launch the activity,
then try to fit these parameters in the launch configuration file:*
~ $ adb shell
$ am start -a android.intent.action.MAIN -c
android.intent.category.LAUNCHER -n com.example.hello/Activity_7 -e
"param_1" "foo" -e "param_2" "boo"
Starting: Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] cmp=com.example.hello/.Activity_7
(has extras) }
OK this worked fine in ADB Shell. I launched directly the 7th step in my
wizard, with params: param_1=foo, param_2=boo and I can now manually test
directly the activity I am working on. I didn't have to go jumping hoops
through all previous 6 steps of the wizard so I can reach where I want and
have a play at the UI.
Now I need to enter this params somehow in "Eclipse->Run->Run
Configurations...->Android Application". Seems there's no means to to that.
Trying to edit directly the launch file from
"workspace\.metadata\.plugins\org.eclipse.debug.core\.launches\Activity_2.launch"xml
file:
[...]
<launchConfiguration
type="com.android.ide.eclipse.adt.debug.LaunchConfigType">
<intAttribute key="com.android.ide.eclipse.adt.action" value="1"/>
<stringAttribute key="com.android.ide.eclipse.adt.activity"
value="com.example.hello.Activity_2"/>
<stringAttribute key="com.android.ide.eclipse.adt.commandline" value=""/>
[...]
No matter what I wrote in the value of
"com.android.ide.eclipse.adt.commandline" or whatever other
"com.android.ide.eclipse.adt.*" attributes I added, I could not manage a
proper activity launch with extras.
I have no idea why I don't find this feature, it seems quite basic in an
IDE, that when you have run configurations for software with various entry
points, you should have a means to pass arguments to them too?
*2. Android JUnit Test*
I need interactive testing. I want to play myself with the UI and see how
the user experience feels like. JUnit tests can do UI automation, monkey
and other UI stuff, but what I want from it is to start the activity I want
and then give me the control for a while.
So far I didn't find interactive support in Android Unit Test. Does such a
feature exist?
Many thanks for your reading this and any helpful thoughts you might have.
Mihai
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en