Search code examples
androidminimizeandroid-launcher

How do I bring the home launcher to front, but not previous activities?


How do I minimize my activity and bring the home launcher to front, but not previous activities?

I need this as I set a wallpaper from my app (which is not a live wallpaper, just a regular app) and need to bring the home launcher to front for the user to see the new wallpaper. Is it possible to do this? I tried finish() but it brings the previous app to front, not the home launcher.


Solution

  • An intent with the Action:

    Intent.ACTION_MAIN
    

    and Category:

    Intent.CATEGORY_HOME
    

    Will Suffice

    Ex:

    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    startActivity(intent);
    

    This will allow the user to go back to home their respective home. Regardless of the launcher type (adw, launcherpro, stock, etc..). Specifically all launchers will handle this Intent Action/Category.