[android-developers] How to capture keyPress of the Next button in a WebView
Hi,
I have an Html input type="number" and when rendered in WebView it
seems to convert this into a WebTextView.
That overrides the onEditorAction to
public void onEditorAction(int actionCode) {
switch (actionCode) {
case EditorInfo.IME_ACTION_NEXT:
if (mWebView.nativeMoveCursorToNextTextInput()) {
// Preemptively rebuild the WebTextView, so that the
action will
// be set properly.
mWebView.rebuildWebTextView();
setDefaultSelection();
mWebView.invalidate();
}
break;
case EditorInfo.IME_ACTION_DONE:
super.onEditorAction(actionCode);
break;
case EditorInfo.IME_ACTION_GO:
case EditorInfo.IME_ACTION_SEARCH:
// Send an enter and hide the soft keyboard
InputMethodManager.getInstance(mContext)
.hideSoftInputFromWindow(getWindowToken(), 0);
sendDomEvent(new KeyEvent(KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_ENTER));
sendDomEvent(new KeyEvent(KeyEvent.ACTION_UP,
KeyEvent.KEYCODE_ENTER));
default:
break;
}
}
That doesn't seem to send any KeyEvent into the DOM so if I wanted to
bind to a keypress event, it doesn't get called.
Any ideas on how to bind a keypress event in the javascript side when
using WebView for a TextView that shows the "Next" button. Basically I
want to bind to this button so I can submit a form when it is the last
field in the form.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home