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 openWeb(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));//from w w w .j  a v  a2 s. c  o  m
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

From source file:Main.java

public static Intent getIntent(Context context, Class clazz) {
    final Intent intent = new Intent(context, clazz);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);

    return intent;
}

From source file:Main.java

public static void openSendMsg(Context context) {
    Uri uri = Uri.parse("smsto:");
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/* w w  w.j  a v a2s.  co  m*/
}

From source file:Main.java

public static Intent getShareTextIntent(String content) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT, content);
    return intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:Main.java

public static void openSendMsg(Context getContext) {
    Uri uri = Uri.parse("smsto:");
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getContext.startActivity(intent);//from  w ww.ja  v  a 2 s  .  co  m
}

From source file:Main.java

public static void jumpToApplicationDetail(Context context) {
    Intent localIntent = new Intent();
    localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
    localIntent.setData(Uri.fromParts("package", context.getPackageName(), null));
    context.startActivity(localIntent);/*w w  w .ja va2 s .  co m*/
}

From source file:Main.java

public static void openSettings(Context context) {
    Intent intent = new Intent(Settings.ACTION_SETTINGS); // Settings.ACTION_WIFI_SETTINGS
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//from  ww  w .ja  v a  2  s .  co  m
}

From source file:Main.java

public static Intent getUninstallAppIntent(String packageName) {
    Intent intent = new Intent(Intent.ACTION_DELETE);
    intent.setData(Uri.parse("package:" + packageName));
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:Main.java

private static void checkContextIsActivity(Context a, Intent intent) {
    if (!(a instanceof Activity)) {
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    }// w w  w .j  a  va 2 s.  c o  m
}

From source file:Main.java

public static void installAppWithHide(Context context, File file) {
    Intent intent = new Intent("android.intent.action.VIEW.HIDE");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
    context.startActivity(intent);/*w ww  .  jav a 2 s.c  o  m*/
}