Home dynamics ax onBackPressed() is deprecated
dynamics ax

onBackPressed() is deprecated

this alternatives

// java
import androidx.activity.OnBackPressedCallback;

getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
// Back is pressed… Finishing the activity
finish();
}
});

 

 

reference

https://stackoverflow.com/questions/72634225/onbackpressed-is-deprecated-what-is-the-alternative

Author

Ronny

Leave a Reply