How do I exit the application and show the home screen?

Asked 2 years ago, Updated 2 years ago, 86 views

The application has a button called EXIT that lets you go to the home screen. When this button is pressed, I want to have a screen showing the application icon on my phone, what should I do?

android exit back-button

2022-09-22 21:41

1 Answers

Android does not recommend that users choose to exit the application. Those things are managed by the OS. However, you can import the home screen using Intent.

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);


2022-09-22 21:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.