Hope you have a great day!
So today I have got a simple question. When I press the back button in my main activity, I want to make sure that whatever I have done this application does not make any difference. Remove the pile, and open it the next time.
Activities work like this:
A (main menu) <4> Here are four buttons, D ( D , D (Change Theme) , D ( Strong> F (lead to) , e (calculation of BMI with measurement of the EU).
When I am in F and pressing back (D or E) - that is fixed and the last type for this feature
F activity has a button to go back to the menu directly, and if I press the button and then standard Android back button, then I will get A from D / E and then before app closure.
When I am in B, C, D, E, I want to return to A. When I am in A , Then I have to close the application.
There is a setting for each of them:
A - On BackPress () - here I want to close the application. OnClickA / B / C / D () {Intent.addFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent FLAG_ACTIVITY_NEW_TASK); StartActivity; End(); } B - Android: noHistory (true) on backpress () {new intent A. Get started} C - Android: No reality on backdoca (true) (start new intent) (hence these changes have an impact on the main menu, even if you pressed back). } D - On Backpress () {Start New Intent (); } E-On Backpress () {New Intent A Fin (Start); } F - nothing specific
You can use the System.exit (0) method Can Be Backpress ()
No comments:
Post a Comment