Search code examples
android-fragmentsandroid-activitycommand-lineadb

Accessing the android fragments using adb commands


Similar to what I have seen for an Activity in Android being started using the following adb command :

startCommand = "adb shell am start -n " + appPackage + "/." + appActivity;

Is there a way to selectively start a fragment inside an activity?


Solution

  • you just need to add an extra named :android:show_fragment with the fragment name to your am start command:

    am start -n com.android.settings/.Settings -e ":android:show_fragment" com.android.settings.LocalePicker