彙整一些取得Android Intent的方便函數



取得Android Home,Launcher2, Launcher3(Androi 7.1/TV), 設定頁, Wifi設定頁

static public Intent getAndroidHomeActivityIntent() {
    Intent intent = new Intent(Intent.ACTION_MAIN);    intent.addCategory(Intent.CATEGORY_HOME);    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);    return intent;}

static public Intent getLauncher2ActivityIntent() {
    Intent intent = new Intent(Intent.ACTION_MAIN);    intent.setComponent(ComponentName.unflattenFromString(
            "com.android.launcher/com.android.launcher2.Launcher"));    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);    return intent;}

static public Intent getLauncher3ActivityIntent() {
    Intent intent = new Intent(Intent.ACTION_MAIN);    intent.setComponent(ComponentName.unflattenFromString(
            "com.android.launcher3/com.android.launcher3.Launcher"));    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);    return intent;}

static public Intent getSettingActivityIntent() {
    Intent intent = new Intent(Settings.ACTION_SETTINGS);    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);    return intent;}

static public Intent getWifiActivityIntent() {
    Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS);    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);    return intent;}

留言