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 void installApk(Context context, String path) {
    File file = new File(path);
    if (file.exists()) {
        Intent installIntent = new Intent(Intent.ACTION_VIEW);
        installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        installIntent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
        context.startActivity(installIntent);
    }//from  w ww  .jav a  2  s  . co m
}

From source file:Main.java

public static void exitGapdeApp_auto(Context context) {
    Intent intent = new Intent("android.intent.action.VIEW",
            android.net.Uri.parse("androidauto://appExit?sourceApplication=launcher"));
    intent.setPackage("com.autonavi.amapauto");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//from w  w w  .j  av a 2s.c o m
}

From source file:Main.java

public static void openView(Context context, String url) {
    try {//ww w.  j ava  2  s  . co m
        Intent intentUri = new Intent(Intent.ACTION_VIEW);
        intentUri.setData(Uri.parse(url));
        intentUri.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intentUri);
    } catch (Exception e) {
    }
}

From source file:Main.java

public static void updateSys(Context context, String filePath) {
    Uri iru = Uri.fromFile(new File(filePath));
    Intent inten = new Intent(Intent.ACTION_VIEW);
    inten.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    inten.setDataAndType(iru, "application/vnd.android.package-archive");
    context.startActivity(inten);/*from  w  w w .  j  ava  2 s  .  com*/
}

From source file:Main.java

public static void installApk(Context context, File apkFile) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    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 a2s .  co  m*/
}

From source file:Main.java

public static void openAppDetailSetting(Context context, String packageName) {
    Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    Uri uri = Uri.fromParts("package", packageName, null);
    intent.setData(uri);/*from  w ww .  j  a v a2s  .c  o  m*/
    context.startActivity(intent);
}

From source file:Main.java

/**
 * Activity Not Finish Jump//from w w w. j  a  v a  2 s .  c o  m
 */
public static void gotoActivityNotFinishWithExtras(Context context, Class<?> actClass, Bundle bundle) {
    Intent intent = new Intent(context, actClass);
    intent.putExtras(bundle);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

From source file:Main.java

public static void forward(Context context, Class<?> dest, Bundle extras) {
    Intent intent = new Intent(context, dest);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (null != extras) {
        intent.putExtras(extras);// w  w  w  . j a  v a  2s  . c  o m
    }
    context.startActivity(intent);
}

From source file:Main.java

public static void gotoDeskTop(AccessibilityService service) {
    try {/* w w w .j  av a2s .  com*/
        Intent home = new Intent(Intent.ACTION_MAIN);
        home.addCategory(Intent.CATEGORY_HOME);
        home.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        service.getApplicationContext().startActivity(home);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void install(Context context, String filePath) {
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setDataAndType(Uri.parse("file://" + filePath), "application/vnd.android.package-archive");
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(i);//from   ww w.ja v a  2s  . c o  m
}