Reputation: 3587
I have an activity that requires a parameter be passed as an intent extra when the activity is started. Is there any way I can set a demo parameter from a run configuration to allow me to to run the activity from Android Studio without creating a temporary default activity that launches the activity I am working on?
Upvotes: 3
Views: 1970
Reputation: 3587
With credit to CommonsWare, here is the solution:
In the configuration, set the correct flags for am
, in my case -e
for a String
extra:
-e "extra_key" "extra_value"
Alternatively, for an int
extra, you could use the flag --ei
:
--ei "extra_key" 1
This goes in the "Launch Flags" field (with a specified activity) in the launch options section of the configuration edit dialog.
Upvotes: 11