Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

onBackPressed() not being executed

Tags:

android

I'm implementing the onBackPressed() method in my activity. It's crucial to my app that I have this functionality. But, the control never enters this function. It enters onPause() instead, when I press the back button.

But the problem is I can't have the same logic in onPause() because when I call another activity, the current activity calls onPause() and I don't want it to execute what should be in onBackPressed().

Please help.

public void onBackPresed(){

   Log.d(TAG,"inside onBackPressed()");
       if(STATE == PREVIEW){

       } 
}
like image 814
Namratha Avatar asked Feb 17 '26 06:02

Namratha


1 Answers

public void onBackPresed(){

you typed one 's', it should be onBackPressed()

like image 151
Mathias Conradt Avatar answered Feb 19 '26 20:02

Mathias Conradt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!