1. 程式人生 > >Launcher App與進入系統其他應用

Launcher App與進入系統其他應用

1、作為launcher啟動:

與普通app不同的是加了兩個

<category android:name="android.intent.category.DEFAULT" />

<category android:name="android.intent.category.HOME" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.HOME" />
            </intent-filter>
        </activity>
        <activity android:name=".Main2Activity" />
        <activity android:name=".Main3Activity"></activity>
    </application>

 

2、進入setting:

通過包名啟動設定

com.android.settings/com.android.settings.Settings

示例:(程式碼示例僅供參考)

private void goSystemSetting(){

    try {
        Intent intent = new Intent();
        ComponentName componentName =

new ComponentName("com.android.settings", "com.android.settings.Settings");
        intent.setComponent(componentName);
        startActivity(intent);
    } catch (Exception e) {
        Log.
e(this.getLocalClassName(), e.toString());
    }

}