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 InstallApk(Context context, String path) {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(android.content.Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive");
    context.startActivity(intent);/*from www.  j a v a 2 s. c  o  m*/
}

From source file:Main.java

public static void installApk(Context context, File file) {
    Intent intent = new Intent();
    intent.addFlags(268435456);
    intent.setAction("android.intent.action.VIEW");
    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
    context.startActivity(intent);/*from   www.  j a  va  2  s.  c o m*/
}

From source file:Main.java

public static Intent getApkFileIntent(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, "application/vnd.android.package-archive");
    return intent;
}

From source file:Main.java

public static void goHome(Activity parent) {
    Intent i = new Intent(parent, Main.class);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP + Intent.FLAG_ACTIVITY_NEW_TASK);
    parent.startActivity(i);//www  . j a  v  a  2  s . c  om
}

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);//from   w w w. ja  va  2 s. c o m
}

From source file:Main.java

public static void installApp(Context context, File apkFile) {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(android.content.Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");

    context.startActivity(intent);//  w ww  .  j  ava  2s . c o m
    // YxCfgManager.getYxCfgInstance().write(YxAppCfg.IS_FIRST, true);
}

From source file:Main.java

public static void redirectWithClearTop(Activity activity, Class<?> cls) {
    Intent intent = new Intent(activity, cls);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    activity.startActivity(intent);//w  w  w . j a  v  a 2 s  .co m
    activity.overridePendingTransition(0, 0);
}

From source file:Main.java

public static void startActivityMarketOnCutinManagerPage(Context context) {
    Intent intent = buildMarketIntent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*from w  w w.ja  v  a  2s .  c  om*/
}

From source file:Main.java

public static void openActivity(Context context, Class<Activity> cls) {
    if (null == context || null == cls)
        return;/*from  ww w . j  av a  2 s . c  o  m*/

    Intent i = new Intent(context, cls);
    i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
    context.startActivity(i);
}

From source file:Main.java

public static void startActivity(Context ctx, Intent intent) {
    intent.addFlags(intent.FLAG_ACTIVITY_NEW_TASK);
    ctx.startActivity(intent);/*  w w w  . j  a  va 2s  .  co m*/
}