List of usage examples for android.content Intent addFlags
public @NonNull Intent addFlags(@Flags int flags)
From source file:cc.flydev.launcher.InstallShortcutReceiver.java
private static ShortcutInfo getShortcutInfo(Context context, Intent data, Intent launchIntent) { if (launchIntent.getAction() == null) { launchIntent.setAction(Intent.ACTION_VIEW); } else if (launchIntent.getAction().equals(Intent.ACTION_MAIN) && launchIntent.getCategories() != null && launchIntent.getCategories().contains(Intent.CATEGORY_LAUNCHER)) { launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); }// ww w. j av a 2 s. co m LauncherAppState app = LauncherAppState.getInstance(); return app.getModel().infoFromShortcutIntent(context, data, null); }
From source file:com.andrewshu.android.reddit.common.Common.java
/** http://developer.android.com/guide/topics/ui/actionbar.html#Home */ public static void goHome(Activity activity) { // app icon in action bar clicked; go home Intent intent = new Intent(activity, ThreadsListActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); activity.startActivity(intent);//from www. j a v a 2s . c o m }
From source file:com.xiaomi.account.utils.SysHelper.java
public static void goToEmailPage(Activity activity, String url) { Intent intent = new Intent("android.intent.action.VIEW"); intent.setData(Uri.parse(url));/*from w w w .j a v a2s .co m*/ intent.addFlags(67108864); intent.addFlags(268435456); intent.addFlags(8388608); activity.startActivity(intent); }
From source file:com.dv.Utils.Tools.java
/** * install app//from www . j a va 2s. com * * @param context * @param filePath * @return whether apk exist */ public static boolean install(Context context, String filePath) { Intent i = new Intent(Intent.ACTION_VIEW); File file = new File(filePath); if ((file != null) && (file.length() > 0) && file.exists() && file.isFile()) { i.setDataAndType(Uri.parse("file://" + filePath), "application/vnd.android.package-archive"); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); return true; } return false; }
From source file:git.lawpavilionprime.auth._Login.java
static void LoadSession() { //TODO: uncomment this if (SIGN_IN_TYPE == LOGGED_OUT_USER_TYPE) { // Restart the activity Intent intent = new Intent(mContext, _Login.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); mContext.startActivity(intent);/*from w ww . j a va 2 s. com*/ } else if (SIGN_IN_TYPE == NEW_USER_TYPE) { //Integer maxDeviceCount = Integer.valueOf(max_device_count) Integer nDeviceCount = Integer.valueOf(device_count); Integer maxDeviceCount = 1; if (nDeviceCount < maxDeviceCount) { txtProgressMessage.setText("Finishing..."); mProgressBar.setVisibility(View.VISIBLE); //Send the Device ID.. AsyncManager.runBackgroundTask(new _AsyncSendDeviceId()); SharedPreferences sharedPref = mContext.getSharedPreferences(_Login.class.getSimpleName(), Context.MODE_PRIVATE); String gcmID = sharedPref.getString("registration_id", null); if (gcmID == null) { //generate n send GCM ID new RegisterApp(mContext).execute(); Log.d("--DEBUG--", "not available"); } else { //Send GCM ID Log.d("--DEBUG---CHECK", gcmID); new RegisterApp(mContext).execute(); } } else { //notify of max usage of device //drop table.. dbAdapter.open(DB_NAME); dbAdapter.executeQuery("DROP TABLE " + dbAdapter.TABLE_NAME); dbAdapter.close(); Toast.makeText(mContext, "Maximum number of device reached", Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(mContext, "Error", Toast.LENGTH_SHORT).show(); } }
From source file:com.android.launcher4.InstallShortcutReceiver.java
private static ShortcutInfo getShortcutInfo(Context context, Intent data, Intent launchIntent) { if (launchIntent.getAction() == null) { launchIntent.setAction(Intent.ACTION_VIEW); } else if (launchIntent.getAction().equals(Intent.ACTION_MAIN) && launchIntent.getCategories() != null && launchIntent.getCategories().contains(Intent.CATEGORY_LAUNCHER)) { launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); }/* ww w .java 2 s.c o m*/ LauncherAppState app = LauncherAppState.getInstance(); ShortcutInfo info = app.getModel().infoFromShortcutIntent(context, data, null); info.title = ensureValidName(context, launchIntent, info.title); return info; }
From source file:Main.java
public static void goToInstalledAppDetails(Context context, String packageName) { Intent intent = new Intent(); int sdkVersion = Build.VERSION.SDK_INT; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.fromParts("package", packageName, null)); } else {// w w w. ja v a2s. co m intent.setAction(Intent.ACTION_VIEW); intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails"); intent.putExtra( (sdkVersion == Build.VERSION_CODES.FROYO ? "pkg" : "com.android.settings.ApplicationPkgName"), packageName); } intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:com.xiaomi.account.utils.SysHelper.java
public static void getbackPassword(Activity activity) { Intent intent = new Intent("android.intent.action.VIEW"); intent.setData(Uri.parse(com.xiaomi.account.Constants.PASSWORD_RECOVERY_URL)); intent.addFlags(67108864); intent.addFlags(268435456);//from ww w . ja va 2 s . c om intent.addFlags(8388608); activity.startActivity(intent); }
From source file:com.hoho.android.usbserial.examples.SerialConsoleActivity.java
/** * Starts the activity, using the supplied driver instance. * * @param context//w ww. j a v a 2 s .c om */ static void show(Context context, UsbSerialPort port) { sPort = port; final Intent intent = new Intent(context, SerialConsoleActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY); context.startActivity(intent); }
From source file:com.fvd.nimbus.MainActivity.java
public static void createShortcut(Context context) { Intent shortcutIntent = new Intent(context, MainActivity.class); shortcutIntent.setAction(Intent.ACTION_MAIN); shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); Intent addIntent = new Intent(); addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Nimbus Clipper"); addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(context, R.drawable.app_icon)); addIntent.putExtra("duplicate", false); addIntent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT"); context.sendBroadcast(addIntent);//from ww w . j a va 2s . c om addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); context.sendBroadcast(addIntent); }