I am developing an android application where we are using WebView to display Web page being served from Web Server. Everything is working fine except with the problem that when i am using the soft keyboard and switched to numeric key entry and move from first field to next field, the keyboard layout automatically changed to alphanumeric.
Is there any way using which i can pull up virtual keyboard in numeric mode only when i need to enter numbers only?
Thanks and Regards.
editTextField.setRawInputType(Configuration.KEYBOARD_QWERTY);
This shows the normal key pad with the numeric version first, yet allows you to switch between them.
getInput.setRawInputType(Configuration.KEYBOARD_12KEY);
This shows numeric only, with no option to enter text values.
I ran into a similar situation. I wanted numeric values only, but I have a "hint" that was text. Setting the inputType to number would not allow the hint to be displayed. This works around it fine.
Configuration.KEYBOARD_12KEY
or Configuration.KEYBOARD_QWERTY
is wrong way.
You have to use InputType (show doc here) on the EditText setRawInputType()
.
If you are talking about HTML, you could use HTML5 features, for example:
Number: <input type="number" name="points" min="1" max="10" />
Have tested this in HTC Desire browser, and it brings up different (numeric) keyboard when you enter data into such field.
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