Example usage for android.content Intent CATEGORY_HOME

List of usage examples for android.content Intent CATEGORY_HOME

Introduction

In this page you can find the example usage for android.content Intent CATEGORY_HOME.

Prototype

String CATEGORY_HOME

To view the source code for android.content Intent CATEGORY_HOME.

Click Source Link

Document

This is the home activity, that is the first activity that is displayed when the device boots.

Usage

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);//ww  w .  j av  a2s . 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);/*from w  w w. java2  s  .  c  o  m*/
}

From source file:Main.java

static void showDesktop(Context ctx) {
    Intent mHomeIntent;/*ww w.  j  a v  a 2  s .c o 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 startLauncher(Context context) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    context.startActivity(intent);/*from  ww w. j  a  va 2 s . c o m*/
}

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  va2s  . com
}

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   w  w w.j  a  v  a 2  s . c  om
}

From source file:Main.java

public static void showDesk(Context context) {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addCategory(Intent.CATEGORY_HOME);
    context.startActivity(intent);//from w ww .  j ava2s.co  m
}

From source file:Main.java

public static final void gotoHome(Context context) {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addCategory(Intent.CATEGORY_HOME);
    context.startActivity(intent);/*from w  w  w .  ja  va2s. c o 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 "";
    }//from w  w  w . j a va  2  s  . co  m
    return res.activityInfo.loadLabel(application.getPackageManager()).toString();
}

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. jav a 2s  .com
        if (res.activityInfo.packageName.equals(application.getPackageName()))
            return true;
        else
            return false;
    }
}