List of usage examples for android.content Intent addCategory
public @NonNull Intent addCategory(String category)
From source file:Main.java
/** * Launch an intent in the CATEGORY_DEFAULT. * @param activity The activity to launch from * @param intent The intent to launch/* ww w .j av a 2 s. c o m*/ */ public static void launchDefaultIntent(final Activity activity, final Intent intent) { intent.addCategory(Intent.CATEGORY_DEFAULT); activity.startActivity(intent); }
From source file:Main.java
public static void sair(Intent intent, Context context) { intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(intent);/* w w w . ja v a2 s. c o m*/ }
From source file:Main.java
public static void jumpHome(Context context) { Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); context.startActivity(startMain);//w w w .j a va 2 s. co m }
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 w w . j av 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
public static void chooseHomeApp(Context context) { Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(startMain);//from www .ja va 2 s. c o m }
From source file:Main.java
/** * "Exits" the app to the Home screen"./*ww w .j a v a 2s . c o m*/ * @param context Application context */ public static void exitToHome(final Context context) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
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 ww .j a va 2s . c om }
From source file:Main.java
public static List<ResolveInfo> getAllApp(Context context) { Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); return context.getPackageManager().queryIntentActivities(mainIntent, 0); }
From source file:Main.java
/** * Minimizes the app/* ww w . j a v a2 s . co m*/ * @param context the context */ public static void minimizeApp(Context context) { Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(startMain); }
From source file:Main.java
public static String getLauncherPackageName(Context context) { final Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); final ResolveInfo res = context.getPackageManager().resolveActivity(intent, 0); return res.activityInfo.packageName; }