0

When running an application, when the home key is pressed the mobile home page comes to the front. How can i do the same on click of a button named exit ?

AceAbhi
  • 95
  • 1
  • 1
  • 7

2 Answers2

1

Short answer.. you can call finish() to end the current activity (this will not kill your application). However I think you should really consider your decision to include a type of "Exit" button in your application. Please review the mechanics of android and some of the information regarding this behavior.

There is a very nice answer here.

Community
  • 1
  • 1
Quintin Robinson
  • 81,193
  • 14
  • 123
  • 132
0

The Android home screen is an activity and you can launch it like other activities, by using Intent with the android.intent.action.MAIN action and the android.intent.category.HOME category.

kankan
  • 599
  • 1
  • 4
  • 8