Is it possible to check if on back keypressed is checked in android within the onbackeypressed method ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can put a condition in the method you override. To get the normal behaviour, you can use
super.onBackPressed(). So let’s say you have aBooleancalled ‘condition’, and you only want to the button to do something if thisBooleanistrue, you can use this code for that.If your check is more complicated, you may want to consider putting it in a method that returns a
Booleaninstead.