tags:

views:

54

answers:

2

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 ?

+1  A: 

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.

Quintin Robinson
A: 

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
Hey thanks, that is what i wanted exactly.
AceAbhi