List of usage examples for android.content Intent addFlags
public @NonNull Intent addFlags(@Flags int flags)
From source file:Main.java
public static void uninstall(Context context, String packageName) { Uri packageURI = Uri.parse("package:" + packageName); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI); uninstallIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(uninstallIntent); }
From source file:Main.java
public static void jumpToActivity(Context context, ComponentName componentName, String... datas) { Intent mIntent = new Intent(); mIntent.addFlags(268435456); mIntent.setComponent(componentName); mIntent.setAction("android.intent.action.VIEW"); if (datas != null) { for (int i = 0; i < datas.length; ++i) { mIntent.putExtra("data" + i, datas[i]); }//from www .j a va2 s .co m } context.startActivity(mIntent); }
From source file:Main.java
public static void unInstallPackage(Context context, String packageName) { Uri packageUri = Uri.fromParts("package", packageName, null); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageUri); uninstallIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(uninstallIntent); }
From source file:Main.java
public static void callPhone(Context context, String number) { Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(URL_TEL + number)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);//from w ww. j av a 2 s.c o m }
From source file:Main.java
private static boolean addFlagIfExist(int flag, Intent intent, Intent redirectIntent) { if (isContainFlag(intent, flag)) { redirectIntent.addFlags(flag); return true; }/*from ww w . j a v a2 s.co m*/ return false; }
From source file:Main.java
public static void openActivity(Context context, Class<?> activity, Bundle b, int flags) { Intent intent = new Intent(context, activity); intent.addFlags(flags); if (b != null) intent.putExtras(b);/*from w w w.j a va2 s .com*/ context.startActivity(intent); }
From source file:Main.java
public static void openURL(final Context ctx, final String url) { final Intent i2 = new Intent(Intent.ACTION_VIEW); i2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i2.setData(Uri.parse(url));//from w w w. j a v a 2 s.com ctx.startActivity(i2); }
From source file:Main.java
protected static void startActivity(Activity activity, Class cls, int flags) { Intent intent = new Intent(activity, cls); if (flags > 0) { intent.addFlags(flags); }/*from www . ja v a 2s.c om*/ activity.startActivity(intent); }
From source file:Main.java
public static void openVideo(Context mContext, String videoPath) { Intent intent = new Intent("android.intent.action.VIEW"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("oneshot", 0); intent.putExtra("configchange", 0); Uri uri = Uri.fromFile(new File(videoPath)); intent.setDataAndType(uri, "video/*"); mContext.startActivity(intent);/*from w ww . j ava2 s .c o m*/ }
From source file:Main.java
/** * Finish the given activity and start a home activity class. * <p/>/* w ww. ja v a2 s . co m*/ * This mirror the behavior of the home action bar button that clears the * current activity and starts or brings another activity to the top. * * @param activity * @param homeActivityClass */ public static void goHome(Activity activity, Class<?> homeActivityClass) { activity.finish(); Intent intent = new Intent(activity, homeActivityClass); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); activity.startActivity(intent); }