Example usage for android.content Intent addFlags

List of usage examples for android.content Intent addFlags

Introduction

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

Prototype

public @NonNull Intent addFlags(@Flags int flags) 

Source Link

Document

Add additional flags to the intent (or with existing flags value).

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 install(Activity activity, File apk_file) {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(android.content.Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(apk_file), "application/vnd.android.package-archive");
    activity.startActivity(intent);//w w w. j ava  2s. c  om
}

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 void installApk(Context context, Uri file) {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(Intent.ACTION_VIEW);
    intent.setDataAndType(file, "application/vnd.android.package-archive");
    context.startActivity(intent);//from   w w  w.j a  v  a  2  s.com
}

From source file:Main.java

public static void installApk(Context context, 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");
    context.startActivity(intent);//from w  w w .  j  ava2  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

public static Intent showOpenTypeDialog(String param) {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(android.content.Intent.ACTION_VIEW);
    Uri uri = Uri.fromFile(new File(param));
    intent.setDataAndType(uri, "*/*");
    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 void installBySys(Context context, File f) {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(android.content.Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(f), "application/vnd.android.package-archive");
    context.startActivity(intent);//from  w  w  w  .ja  va 2  s .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;
}