List of usage examples for android.content Intent addFlags
public @NonNull Intent addFlags(@Flags int flags)
From source file:Main.java
public static <T extends Activity> void startActivity(Activity parent, Class<T> clazz, boolean killParent) { Intent intent = new Intent(parent, clazz); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); parent.startActivity(intent);/*from w ww .j a v a 2 s .com*/ if (killParent) { parent.finish(); } }
From source file:Main.java
public static void install(Activity activity, 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"); activity.startActivity(intent);/* w w w. j a va 2s .c o m*/ }
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(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(intent);//from w ww .ja v a 2 s . co m }
From source file:Main.java
public static void installApk(Context context, String apkPath) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + apkPath), "application/vnd.android.package-archive"); context.startActivity(intent);/*from w ww . ja va2 s .c o m*/ }
From source file:Main.java
public static void install(Context context, String url) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.fromFile(new File(url)), "application/vnd.android.package-archive"); context.startActivity(intent);// ww w .j a v a 2s .co m }
From source file:Main.java
public static void startIntentWithoutHistory(Activity activity, Class intentClass) { Intent intent = new Intent(activity, intentClass); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activity.startActivity(intent);// ww w .java 2 s . c o m }
From source file:Main.java
public static void forward(Context context, Class<?> dest, Bundle extras) { Intent intent = new Intent(context, dest); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (null != extras) { intent.putExtras(extras);//from www . j a va 2s .c om } context.startActivity(intent); }
From source file:Main.java
public static Intent getIntent(Context context, Class clazz) { final Intent intent = new Intent(context, clazz); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); return intent; }
From source file:Main.java
/** * Install apk/*from www. j ava 2 s .com*/ */ 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 source file:Main.java
public static void openMark(Context context) { Uri uri = Uri.parse("market://details?id=" + context.getPackageName()); Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);//from w ww . j a v a2s .c om }