I want to use onBackPressed() method and still want to provide support for Android SDK before 2.0. onBackPressed() is introduced in Android SDK 2.0. but how to do ?
Using onKeyDown;
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
// Your Code Here
return true;
}
return super.onKeyDown(keyCode, event);
}
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