Ativity启动指定的settings

Intent it = new Intent(Intent.ACTION_MAIN);
it.setClassName("com.android.phone","com.android.phone.CallFeaturesSetting");
startActivity(it);

 

简单注释下: intent.ACTION_MAIN

                  "com.android.phone"

                 "com.android.phone.CallFeatureSetting"

这些值可以根据想要打开的设置界面查找到,比如 call setting.我们在packages\apps\Settings\res\xml\settings.xlm

 

 <com.android.settings.IconPreferenceScreen android:key="call_settings" settings:icon="@drawable/ic_settings_call" android:title="@string/call_settings_title"> <intent android:action="android.intent.action.MAIN"  android:targetPackage="com.android.phone" android:targetClass="com.android.phone.CallFeaturesSetting" /> </com.android.settings.IconPreferenceScreen>

 

红色字体就是我们想要跳转到的对应包和类名。

这样我们可以使用setClassName方法来跳转到我们指定的setting界面。

 

  

Intent it = new Intent();

it.setAction(Settings.ACTION_WIRELESS_SETTINGS);

startActivity(it);

  根据指定的action

 

settings.java:

    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    public static final String ACTION_WIRELESS_SETTINGS =
            "android.settings.WIRELESS_SETTINGS";

 不是很明白这是根据什么来启动,类名?

你可能感兴趣的:(intent,Settings)