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 Intent getShowOrbotStartIntent() {
    Intent intent = new Intent(ACTION_START_TOR);
    intent.setPackage(ORBOT_PACKAGE_NAME);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}

From source file:Main.java

public static final void install(Context context, String path) {
    Intent intent = new Intent();
    intent.setAction(android.content.Intent.ACTION_VIEW);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.parse("file://" + path), "application/vnd.android.package-archive");
    context.startActivity(intent);/*  ww  w.  j av  a2s  . c o m*/
}

From source file:Main.java

public static void launchActivity(Context context, Class<?> activity, Bundle bundle) {
    Intent intent = new Intent(context, activity);
    intent.putExtras(bundle);//from  w w  w .ja v  a  2s .  co  m
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    context.startActivity(intent);
}

From source file:Main.java

public static void dial(Context context, String number) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + number));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//ww w . j ava  2s . c om
}

From source file:Main.java

protected static boolean InstallServiceQuiet(Context context) {
    boolean result = true;
    try {/* w ww.  j a  v  a2s  .  c o  m*/
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(OPEN_CV_SERVICE_URL));
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    } catch (Exception e) {
        result = false;
    }

    return result;
}

From source file:Main.java

public static void CloseActivity(Activity activity, Class<?> class1) {
    Intent intent = new Intent(activity, class1);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    activity.startActivity(intent);/*  www .j  a va  2  s .  co  m*/
}

From source file:Main.java

public static void startActivity(Context context, Class cls, String nameFlag, Serializable serializable,
        int intentflag) {
    Intent intent = new Intent(context, cls);
    intent.putExtra(nameFlag, serializable);
    intent.addFlags(intentflag);
    context.startActivity(intent);/*from   w w w.  j a va 2s  .  c  o m*/
}

From source file:Main.java

public static void front(Context packageContext, Class<?> cls) {
    Intent intent = new Intent(packageContext, cls);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
    packageContext.startActivity(intent);
    intent = null;// w w  w  .  j a  va2  s . c  om
}

From source file:Main.java

public static void clearActivityTask(final Context context) {
    Intent i = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    context.startActivity(i);/*from www. j  a va 2 s. c o m*/
    ((Activity) context).finish();

}

From source file:Main.java

/**
 * Get the intent used to open installation U.I.
 *
 * @param fileUri downloaded file URI from the download manager.
 * @return intent to open installation U.I.
 *///www  . ja  v a  2s  . c  o  m
@NonNull
static Intent getInstallIntent(Uri fileUri) {
    Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
    intent.setData(fileUri);
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    return intent;
}