Created
May 5, 2011 16:37
-
-
Save codeswimmer/957381 to your computer and use it in GitHub Desktop.
Android: Programmatically Launch Home Screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove the Activity parameter if this is being placed into a class that derives from Activity | |
public void launchHomeScreen(Activity activity) { | |
Intent homeIntent = new Intent(Intent.ACTION_MAIN, null); | |
homeIntent.addCategory(Intent.CATEGORY_HOME); | |
homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); | |
activity.startActivity(homeIntent); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment