我正在以这种方式启动键盘:
InputMethodManager inputMethodService = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputMethodService != null && inputMethodService.isActive()) {
inputMethodService.showSoftInput(view, 0);
}
我正在以这种方式捕捉“完成”:
editField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_DONE) {
...
return true;
}
return false;
}
});
单击硬件后退按钮时,上述方法不会触发。我该如何捕获它?
编辑:我们已尝试onBackPressed()
,onResume()
,onKeyDown()
和onActivityResult()