newbee newbee - 7 months ago 45
Android Question

Go back to home screen after Activity finishes

I have an Activity which keeps beeping till the time the user clicks a button.
On clicking the button, it displays a message. After displaying the message, instead of the user pressing on the back button to exit, I want my activity to exit to the home screen on its own.

Does the

method do this? If yes, how and where should I implement it?

Any kind of help will be appreciated. Thanks

    Intent i= new Intent("package.homescreenactivity");//homescreen of your app.

Go back to home screen by clearing activity stack.

To understand the whole concept i suggest you take a look at this site. The site talks about how activity back stack works.

Update: (August 15th 2014)

Clearing Backstack may not be a good idea. Please have a look at Effective Navigation design guidelines.

Back button is supposed to take you back to the previous activity.