Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save codeswimmer/957381 to your computer and use it in GitHub Desktop.
Save codeswimmer/957381 to your computer and use it in GitHub Desktop.
Android: Programmatically Launch Home Screen
// 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