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 getAppDetailsSettingsIntent(String packageName) {
    Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
    intent.setData(Uri.parse("package:" + packageName));
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:Main.java

@SuppressLint("NewApi")
public static void doSettings(Context context) {
    Intent intent = new Intent(Settings.ACTION_SETTINGS);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*from   w w  w.j a  v a  2 s. c  o m*/
}

From source file:Main.java

public static void installAPK(Context context, File file) {
    if (file == null || !file.exists())
        return;/*from w  w  w  .j a v  a  2s  .  c  o m*/
    Intent intent = new Intent();
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
    context.startActivity(intent);
}

From source file:Main.java

public static void openWebSite(Context context, String url) {
    Uri uri = Uri.parse(url);/*  w ww  .  ja v  a 2 s  .c  o m*/
    Intent it = new Intent(Intent.ACTION_VIEW, uri);
    it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(it);
}

From source file:Main.java

public static void callPhone(Context context, String number) {
    Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(URL_TEL + number));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*from  w w w .ja v a  2  s . c om*/
}

From source file:Main.java

public static void installApkFileFromUri(Context context, Uri appPath) {
    Intent intent = new Intent();
    intent.setDataAndType(appPath, "application/vnd.android.package-archive");
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);// w  ww.j  a  v  a2s.  c  o m
}

From source file:Main.java

public static void startBrowser(Context context, String url) {
    try {/* www.j ava2  s .co m*/
        Intent intent = new Intent();
        intent.setAction("android.intent.action.VIEW");
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        Uri content_url = Uri.parse(url);
        intent.setData(content_url);
        context.startActivity(intent);
    } catch (Exception e) {

    }
}

From source file:Main.java

public static void startActivityNoHistory(Activity activity, Class classActivity) {
    Intent intent = new Intent();
    intent.setClass(activity, classActivity);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    activity.startActivity(intent);/*from w ww .j  av  a  2s  .  c o m*/
}

From source file:Main.java

public static Intent getWordFileIntent(String param) {

    Intent intent = new Intent("android.intent.action.VIEW");

    intent.addCategory("android.intent.category.DEFAULT");

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    Uri uri = Uri.fromFile(new File(param));

    intent.setDataAndType(uri, "application/msword");

    return intent;

}

From source file:Main.java

public static void startInstall(Context context, Uri uri) {
    Intent install = new Intent(Intent.ACTION_VIEW);
    install.setDataAndType(uri, "application/vnd.android.package-archive");
    install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(install);//from   w  w w .  j a v  a2 s . c o  m
}