0

Is there a way to perform "home key" click? Just like button.performClick();

Neil Axinto
  • 79
  • 1
  • 8
  • If there was or not, its not good to manipulate navigation outside of app. Only the user should have this control. If you just want to exit out of app (which can go to home then you can do so). I can't remember for sure or not, but I think only rooted or custom rom can do this? Stuff like Samsung devices I add in as Samsung custom rom so Samsung can. But I don't think Google gives any app developer this ability due to the fact people would abuse it and make people hate Android. – CmosBattery Feb 24 '19 at 01:11
  • I'll look for a different method then... thanks! – Neil Axinto Feb 24 '19 at 01:14
  • 1
    Possible duplicate of [Going to home screen programmatically](https://stackoverflow.com/questions/3724509/going-to-home-screen-programmatically) – Reaz Murshed Feb 24 '19 at 01:31

1 Answers1

0

try this:

 startActivity(
     new Intent(Intent.ACTION_MAIN)
             .addCategory(Intent.CATEGORY_HOME)
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
med.Hamdan
  • 190
  • 1
  • 6