Tuesday, June 18, 2019

Android | Close app on back button


Add in your Activity

Example in MainActivity.class

I want to exit my app when click phone back button

auto shortcut: Ctr + O
----------------
@Override
    public void onBackPressed() {
        super.onBackPressed();
        finishAffinity();
    }
---------------

No comments:

Post a Comment