I have an application wherein on homepage i have buttons for navigation through the application.
In that I have a button "EXIT" which when clicked should take user to home screen on the phone where the application icon is.
How can I do that?
I have an application wherein on homepage i have buttons for navigation through the application.
In that I have a button "EXIT" which when clicked should take user to home screen on the phone where the application icon is.
How can I do that?
It is not recommended to exit your Android Application. See this question for more details.
The user can always quit your app through the home button or in the first activity through the back button.
Hi,
Android's design is not favoring exiting an application by choice, but rather manages it by the OS. You can bring up the Home application by it's corresponding Intent:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Is you simply want to end an activity you can call finish()
.
It however bad practice to have an exit button on the screen.