Can we override hardware back button functionality. I am bit confused about this kindly help me.
You can also override onBackPressed()
:
@Override
public void onBackPressed(){
//Your action
}
@Override public void onBackPressed(){
//do your stuff here
}
if anything related to particular key then you can go for this:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.Any_Key_Code) {
//your stuff 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