So, I don't want to close Action mode on certain condition. so tried to do following
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (my condition) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
return true; // consuming back event here. and yes it gets called on backpress meaning event gets consumed successfully here
}
}
return super.dispatchKeyEvent(event);
}
but still it always closes CAB every time i press back button. what could be the reason ?
Add this in your styles.xml file