How to run Android SubSettings fragment?

For example, how to start user preferences? It is not implemented as its own action, so I'm not sure how to run it.

Below are some other similar questions, but they are more general or more specific. My question is how to run an arbitrary SubSettings fragment.

How can I call a specific PreferenceFragment from a PreferenceActivity?

Only show wireless settings on Android 3

+8
android
source share
2 answers

You can launch most of the Android Settings sub-elements by running SubSettings Activity and including : android: show_fragment with the corresponding full class name of the existing Android PreferenceFragment subclass.

For example, to start UserSettings:

adb shell am start -n com.android.settings/com.android.settings.SubSettings -e :android:show_fragment com.android.settings.users.UserSettings 

Launch DeviceInfoSettings:

 adb shell am start -n com.android.settings/com.android.settings.SubSettings -e :android:show_fragment com.android.settings.DeviceInfoSettings 

These examples use "adb shell am start", but in principle you can call them in Java code (EDIT: Unfortunately, you need to sign with the system key, otherwise you will get a SecurityException). Note that the key for this extra has a colon in front of it. To find other settings, check the Android source and find the PreferenceFragment subclasses in the packages / applications / settings.

In Froyo, the situation was different before. In those days, actions were used to implement sub-items of settings, so it was possible to launch directly into a sub-screen (for example, SoundAndDisplaySettings) by the usual method of calling startActivity () using ComponentName or Action String. This mechanism still works for some sub-items of settings. For example, to call wifi picker, you can use

 adb shell am start -a android.net.wifi.PICK_WIFI_NETWORK 
+8
source share

for MM:

 am start -n com.android.settings/com.android.settings.SubSettings -e :settings:show_fragment com.android.settings.applications.RunningServices 
0
source share

All Articles