Example usage for android.content Intent FLAG_ACTIVITY_NEW_TASK

List of usage examples for android.content Intent FLAG_ACTIVITY_NEW_TASK

Introduction

In this page you can find the example usage for android.content Intent FLAG_ACTIVITY_NEW_TASK.

Prototype

int FLAG_ACTIVITY_NEW_TASK

To view the source code for android.content Intent FLAG_ACTIVITY_NEW_TASK.

Click Source Link

Document

If set, this activity will become the start of a new task on this history stack.

Usage

From source file:Main.java

public static Intent getBootSpeedActivityIntent() {
    Intent intent = new Intent();
    intent.setClassName("com.lenovo.safecenter", "com.lenovo.performancecenter.performance.BootSpeedActivity");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}

From source file:Main.java

public static void openURL(Context ctx, String url) {
    Intent i2 = new Intent(Intent.ACTION_VIEW);
    i2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    i2.setData(Uri.parse(url));/*from   www  .j a va2s  .c  om*/
    ctx.startActivity(i2);
}

From source file:Main.java

public static Intent getBootStartIntent() {
    Intent intent = new Intent();
    intent.setClassName("com.huawei.systemmanager",
            "com.huawei.systemmanager.optimize.bootstart.BootStartActivity");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}

From source file:Main.java

public static Intent getAddViewMonitorIntent() {
    Intent intent = new Intent();
    intent.setClassName("com.huawei.systemmanager",
            "com.huawei.systemmanager.addviewmonitor.AddViewMonitorActivity");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}

From source file:Main.java

public static Intent getNotificationManageIntent() {
    Intent intent = new Intent();
    intent.setClassName("com.huawei.systemmanager",
            "com.huawei.notificationmanager.ui.NotificationManagmentActivity");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}

From source file:Main.java

public static void showInputMethodSettingsPage(Context context) {
    Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);// ww  w.j  av a 2 s. co m
}

From source file:Main.java

public static Intent getAndroidAppNotificationOpenManager() {
    Intent intent = new Intent();
    intent.setClassName("com.android.systemui",
            "com.android.systemui.lenovo.settings.AppNotificationOpenManager");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}

From source file:Main.java

public static void installApk(Context context, File apkfile) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.VIEW");
    intent.addCategory("android.intent.category.DEFAULT");
    intent.setType("application/vnd.android.package-archive");
    intent.setData(Uri.fromFile(apkfile));
    intent.setDataAndType(Uri.fromFile(apkfile), "application/vnd.android.package-archive");
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*from  w w  w .  j  a  v  a2  s  .c o m*/
}

From source file:Main.java

public static Intent getAppNotificationOpenManagerIntent() {
    Intent intent = new Intent();
    intent.setClassName("com.lenovo.systemuiplus",
            "com.lenovo.systemuiplus.notifymanager.AppNotificationOpenManager");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}

From source file:Main.java

public static void startAppByPackageName(Context context, String packageName) {
    PackageInfo pi = null;//  www.j ava 2s .c o m
    try {
        pi = context.getPackageManager().getPackageInfo(packageName, 0);
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null);
    resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER);
    resolveIntent.setPackage(pi.packageName);

    List<ResolveInfo> apps = context.getPackageManager().queryIntentActivities(resolveIntent, 0);

    ResolveInfo ri = apps.iterator().next();
    if (ri != null) {
        String packageName1 = ri.activityInfo.packageName;
        String className = ri.activityInfo.name;

        Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);

        ComponentName cn = new ComponentName(packageName1, className);

        intent.setComponent(cn);
        context.startActivity(intent);
    }

}