List of usage examples for android.content Intent ACTION_MAIN
String ACTION_MAIN
To view the source code for android.content Intent ACTION_MAIN.
Click Source Link
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);/*from w w w . ja va2 s.co m*/ }
From source file:Main.java
public static boolean backToHome(Context c) { Intent i = new Intent(Intent.ACTION_MAIN); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addCategory(Intent.CATEGORY_HOME); c.startActivity(i);/*w w w . j av a 2 s.co m*/ return true; }
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);/*w w w. j a v a 2 s .co m*/ }
From source file:Main.java
public static String getHomeLauncherName(Application application) { final Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); final ResolveInfo res = application.getPackageManager().resolveActivity(intent, 0); if (res.activityInfo == null) { return ""; }// www .ja v a 2 s .c o m return res.activityInfo.loadLabel(application.getPackageManager()).toString(); }
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
public static boolean isLauncherDefault(Application application) { final Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); final ResolveInfo res = application.getPackageManager().resolveActivity(intent, 0); if (res.activityInfo == null) { return false; } else if ("android".equals(res.activityInfo.packageName)) { return false; } else {//from www .j a v a2 s . c om if (res.activityInfo.packageName.equals(application.getPackageName())) return true; else return false; } }
From source file:Main.java
public static String getLActivityName(Context context) { Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.addCategory(Intent.CATEGORY_LAUNCHER); List<ResolveInfo> resolvInfos = context.getPackageManager().queryIntentActivities(intent, 0); String launcherActivityName = ""; for (int i = 0; i < resolvInfos.size(); i++) { launcherActivityName = resolvInfos.get(i).activityInfo.name; }//from w ww . ja v a 2 s. co m return launcherActivityName; }
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; }
From source file:Main.java
public static List<ResolveInfo> getInstalledAppsByActionMainIntent(Context context) { final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); return context.getPackageManager().queryIntentActivities(mainIntent, 0); }
From source file:Main.java
public static void gotoDeskTop(AccessibilityService service) { try {//from w ww . j a va 2s .c om Intent home = new Intent(Intent.ACTION_MAIN); home.addCategory(Intent.CATEGORY_HOME); home.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); service.getApplicationContext().startActivity(home); } catch (Exception e) { e.printStackTrace(); } }