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 launchActivity(Context context, Class<?> activity) {
    Intent intent = new Intent(context, activity);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    context.startActivity(intent);/* w  ww .ja va2  s . c om*/
}

From source file:Main.java

private static PendingIntent makeMoodIntent(Context context, Class class1) {
    Intent intent = new Intent(context, class1);
    intent.addFlags(0x400000);
    intent.addFlags(0x4000000);/*from  ww w .j  a  v a 2 s .  c om*/
    return PendingIntent.getActivity(context, 1, intent, 0x10000000);
}

From source file:Main.java

public static void startActivityClearTask(Activity activity, Class<? extends Activity> clazz) {
    Intent intent = new Intent(activity, clazz);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_CLEAR_TASK
            | Intent.FLAG_ACTIVITY_NEW_TASK);
    activity.startActivity(intent);//w w  w.  j  a  v a 2s.c o  m
    activity.overridePendingTransition(0, 0);
}

From source file:Main.java

public static void startActivity(Activity activity, Class clazz, int flags) {
    Intent intent = new Intent(activity, clazz);
    intent.addFlags(flags);
    activity.startActivity(intent);/*from w w  w  .j  a  v  a 2s.co m*/
}

From source file:Main.java

public static void openActivity(Context context, Class<?> clazz, Bundle... bundles) {
    Intent intent = new Intent(context, clazz);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (bundles != null && bundles.length > 0) {
        intent.putExtras(bundles[0]);/*from  w  w w  .j a v  a  2  s  . c  o  m*/
    }
    context.startActivity(intent);
}

From source file:Main.java

public static void startSettingIntent(Context context, Intent intent) {
    try {//from  w  w  w .  j  a va  2 s  . c o  m
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    } catch (Exception e) {
        intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.setData(Uri.parse("package:" + context.getPackageName()));
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }
}

From source file:Main.java

public static void install(Context context, String filePath) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.fromFile(new File(filePath)), "application/vnd.android.package-archive");
    context.startActivity(intent);/*from   ww  w.  j  a v a  2  s  .c  o  m*/
}

From source file:Main.java

public static void installApp(Context context, String path) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.parse("file://" + path), "application/vnd.android.package-archive");
    context.startActivity(intent);//  www . j  a  v a  2s . com
}

From source file:Main.java

public static void installApk(Context context, File file) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
    context.startActivity(intent);/*from  w  w w.j a va2s.co m*/
}

From source file:Main.java

public static void startActivity(Context context, Class activityClass) {
    Intent intent = new Intent(context, activityClass);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/* w  w w.  j  a v a  2s.  c o  m*/
}