0

I am working on a tablet that will not feature all the navigation buttons, just powerup, so I need a way to go from an activity to show the home screen. What Intent action can i fire that is guaranteed to show clear homescreen? What intent\action fires when you click on the device button that takes you to homescreen. Thanks?

Androider
  • 21,125
  • 36
  • 99
  • 158

3 Answers3

0

just call the following code from any activity:

moveTaskToBack(true);

You may want to add a button of some sort to invoke this function. Good luck

PowerAktar
  • 2,341
  • 1
  • 21
  • 17
0

You could try and finish() all of your activities. Maybe in Application keep a ivar that is showHome, if true on resume() in each activity just call finish(). This is not really standard android behavior though.

Edit** If you want to fire their launcher you can checkout this thread: Going to home screen programmatically

Community
  • 1
  • 1
sgarman
  • 6,152
  • 5
  • 40
  • 44
  • ok. but in android if you push a certain button you always get back to home screen. What Intent is this sending out? – Androider Mar 26 '11 at 02:59
0

Untested Code:

      Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_HOME);
        intent.setClassName("myPackage","myPackage.MyClass");
        intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        try {
             startActivity(intent);
        }
        catch (Exception e)
        {
            Log.d(TAG,"myMethod",e);
        }
JAL
  • 3,319
  • 2
  • 20
  • 17