Redirect to home after clicking the "Back" button

I am creating an application that will ask for a password before opening any other application. To get started, I created an intent that has flags, intent.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK);

The lock / unlock feature works correctly, but when I press the back button it doesn't redirect to the home screen.

+3


source to share


1 answer


Make sure you are not done with the home screen .. or you can try the onBackPressed () method



 @Override
        public void onBackPressed() {
        // INTENT FOR YOUR HOME ACTIVITY
        }

      

+2


source







All Articles