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();
}
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();
}
2
Answers
You need to use
onBackPressedDispatcher.addCallback(new ...)
in youronCreate()
.You can test its execution by displaying a toast in the callback for example.
Use this in your
onCreate()