List of usage examples for android.content Intent FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
To view the source code for android.content Intent FLAG_ACTIVITY_RESET_TASK_IF_NEEDED.
Click Source Link
From source file:Main.java
private static Intent createCalendarIntent(String action) { Intent intent = new Intent(); intent.setAction(action);/*from w w w .j av a2 s .c o m*/ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); return intent; }
From source file:Main.java
static void showDesktop(Context ctx) { Intent mHomeIntent;/* w ww . j a v a 2 s . co m*/ mHomeIntent = new Intent(Intent.ACTION_MAIN, null); mHomeIntent.addCategory(Intent.CATEGORY_HOME); mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); ctx.startActivity(mHomeIntent); }
From source file:Main.java
public static void goHome(Context context) { Intent mHomeIntent = new Intent(Intent.ACTION_MAIN); mHomeIntent.addCategory(Intent.CATEGORY_HOME); mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); context.startActivity(mHomeIntent);// w w w .jav a 2 s . c om }
From source file:Main.java
public static void takeMyselfToForeground(Context context, Class launcher) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClass(context, launcher);//from w w w .ja v a 2 s .c o m intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); context.startActivity(intent); }
From source file:Main.java
public static Intent createLaunchIntent(ComponentName componentName) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setComponent(componentName);/*from w ww . ja v a2 s. c o m*/ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); return intent; }
From source file:Main.java
/** * start home intent/*from www . jav a 2 s. c o m*/ * * @param context */ public static void startHomeActivity(Context context) { Intent homeIntent = new Intent(Intent.ACTION_MAIN); homeIntent.addCategory(Intent.CATEGORY_HOME); homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); context.startActivity(homeIntent); }
From source file:Main.java
public static void openApplication(final Context context, String packageName) { PackageManager packageManager = context.getPackageManager(); Intent intent = packageManager.getLaunchIntentForPackage(packageName); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(intent);//from www . j av a 2 s .c om }
From source file:Main.java
/** * start app//w w w .java2 s . c om * * @param ctx * @param packageName */ public static void startApp(Context ctx, String packageName) { if (!isAppInstalled(ctx, packageName)) { return; } PackageManager packageManager = ctx.getPackageManager(); Intent intent = packageManager.getLaunchIntentForPackage(packageName); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); ctx.startActivity(intent); }
From source file:Main.java
/** * Load the settings activity of a particular joyn client to enable or * disable the client/*from w ww . j a va 2 s. co m*/ * * @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
private static void shareImageOnFacebook(String imagePath, Context context) { Log.d("CitationsManager-ShareOnFb", "sharing the image " + imagePath); Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("image/*"); // shareIntent.putExtra(Intent.EXTRA_TEXT, "www.google.com"); shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(imagePath))); PackageManager pm = context.getPackageManager(); List<ResolveInfo> activityList = pm.queryIntentActivities(shareIntent, 0); for (final ResolveInfo app : activityList) { Log.d("CitationsManager-ShareOnFb", app.activityInfo.name); if ((app.activityInfo.name).contains("com.facebook") && !(app.activityInfo.name).contains("messenger") && !(app.activityInfo.name).contains("pages")) { final ActivityInfo activity = app.activityInfo; final ComponentName name = new ComponentName(activity.applicationInfo.packageName, activity.name); shareIntent.addCategory(Intent.CATEGORY_LAUNCHER); shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); shareIntent.setComponent(name); context.startActivity(shareIntent); break; }/*from w ww . j a v a 2s. c o m*/ } }