I created a Java project on Android Studio. Android target API level 34 but the problem is onbackpressed deprecated. you can see this problem
@Override
public void onBackPressed() {
super.onBackPressed();
}

Use this in your onCreate()
OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
// handle backpressed here
}
};
getOnBackPressedDispatcher().addCallback(this,onBackPressedCallback);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With