I have a custom view that inherites LinearLayout
and that view is in a ViewSwitcher
. I want to return to previous view on Back pressed, So i overriden the onPreKeyIme
in this view but when i press Back, it doesnt seem to enter the method, and the activity handles the Back.
What am I missing?
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK)
return viewModel.backClicked();
return super.onKeyPreIme(keyCode, event);
}
I have a breakpoint in the if-statement and it never freezes there.
PS, I'm not allowed to use fragments.