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 flagAsNewTask(Intent intent) {
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:Main.java

public static void showDesk(Context context) {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addCategory(Intent.CATEGORY_HOME);
    context.startActivity(intent);//from   w  w  w.jav a2  s.  c  o m
}

From source file:Main.java

public static void openDail(Context getContext) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getContext.startActivity(intent);/*  w  ww.  ja va 2s  . co  m*/
}

From source file:Main.java

public static Intent getAllIntent(String param) {

    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(Intent.ACTION_VIEW);
    Uri uri = Uri.fromFile(new File(param));
    intent.setDataAndType(uri, "*/*");
    return intent;
}

From source file:Main.java

private static Intent getApkFileIntent(File file) {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(android.content.Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
    return intent;
}

From source file:Main.java

public static final void gotoHome(Context context) {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addCategory(Intent.CATEGORY_HOME);
    context.startActivity(intent);//from w  ww  . j  a  v a  2  s .  c o m
}

From source file:Main.java

public static Intent getInstallIntent(File file) {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
    return intent;
}

From source file:Main.java

private static Intent getAllIntent(String filePath) {

    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(android.content.Intent.ACTION_VIEW);
    Uri uri = Uri.fromFile(new File(filePath));
    intent.setDataAndType(uri, "*/*");
    return intent;
}

From source file:Main.java

public static Intent getInstallApkIntent(File file) {
    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");
    return intent;
}

From source file:Main.java

public static <T> void startService(Context context, Class<T> clazz) {
    Intent i = new Intent(context, clazz);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startService(i);/*from  w  w w. jav a  2s.  com*/
}