List of usage examples for android.content Intent setFlags
public @NonNull Intent setFlags(@Flags int flags)
From source file:Main.java
public static void displayError(String message, final Class<?> activity, final Context context) { // no deals found so display a popup and return to search options AlertDialog.Builder builder = new AlertDialog.Builder(context); // set title//from w w w. j av a 2 s. c o m builder.setTitle("No Results"); // set dialog message builder.setMessage(message).setCancelable(false).setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); Intent i = new Intent(context, activity); ((Activity) (context)).finish(); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY); context.startActivity(i); } }); // create alert dialog AlertDialog alertDialog = builder.create(); // show it alertDialog.show(); }
From source file:Main.java
/** * Install a given file via package installer * /* w ww .j ava 2 s . com*/ * @param context * @param file */ public static void installFile(Context context, File file) { if (file != null) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } }
From source file:Main.java
public static void startActivity(Context context, Intent intent) { if (context == null || intent == null) { return;//from w w w. ja va2 s .co m } if (!(context instanceof Activity)) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } try { context.startActivity(intent); } catch (Exception e) { } }
From source file:Main.java
public static void applyPermission(Context context) { Intent intent = new Intent(); intent.setClassName("com.android.settings", "com.android.settings.Settings$OverlaySettingsActivity"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (isIntentAvailable(intent, context)) { context.startActivity(intent);//from ww w.java2 s . c o m } else { intent.setClassName("com.qihoo360.mobilesafe", "com.qihoo360.mobilesafe.ui.index.AppEnterActivity"); if (isIntentAvailable(intent, context)) { context.startActivity(intent); } else { Log.e(TAG, "can't open permission page with particular name, please use " + "\"adb shell dumpsys activity\" command and tell me the name of the float window permission page"); } } }
From source file:Main.java
public static void installApk(Context context, String apkPath) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(apkPath)), "application/vnd.android.package-archive"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);/*from w w w . j a v a 2s. c o m*/ }
From source file:Main.java
/** * Load the settings activity of a particular joyn client to enable or * disable the client/* w w w . j a va2 s .com*/ * * @param context Application context * @param appInfo Application info */ public static void loadJoynClientSettings(Context context, ResolveInfo appInfo) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(new ComponentName(appInfo.activityInfo.packageName, appInfo.activityInfo.name)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); context.startActivity(intent); }
From source file:Main.java
public static void send(Context context, String path) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); PackageManager pm = context.getPackageManager(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setType("*/*"); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(path))); List<ResolveInfo> list = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); boolean flag = false; for (ResolveInfo info : list) { if (info.activityInfo.packageName.toLowerCase().contains("bluetooth") || info.activityInfo.name.toLowerCase().contains("bluetooth")) { ApplicationInfo appInfo = null; try { appInfo = pm.getApplicationInfo(info.activityInfo.packageName, PackageManager.GET_META_DATA); } catch (PackageManager.NameNotFoundException e) { }// w w w . java 2 s .c om if (appInfo != null && (appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) == 0 && (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { intent.setClassName(info.activityInfo.packageName, info.activityInfo.name); flag = true; break; } } } if (!flag) { return; } context.startActivity(intent); }
From source file:Main.java
public static void openYYB2(Context context) { Intent intent2 = new Intent(); intent2.setComponent(new ComponentName("com.tencent.android.qqdownloader", "com.connector.tencent.connector.ConnectionActivity")); intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent2);/*from ww w. java 2s . c o m*/ }
From source file:com.appnexus.opensdk.PBImplementation.java
private static void launchApp(Context context) { Intent intent = new Intent(Intent.ACTION_VIEW, URI_LAUNCH_APP); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try {/*from w ww .j a v a 2s.co m*/ context.startActivity(intent); } catch (ActivityNotFoundException e) { Clog.w(Clog.baseLogTag, Clog.getString(R.string.opening_url_failed, URI_LAUNCH_APP.toString())); } }
From source file:gov.nasa.arc.geocam.talk.UIUtils.java
/** * Go to the {@link GeoCamTalkLogon} activity. * * @param context The activity context to send the intent from. */// ww w.j av a 2 s . c om public static void goToLogin(Context context) { final Intent intent = new Intent(context, GeoCamTalkLogon.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }