Java Code Examples for android.view.inputmethod.EditorInfo#TYPE_NUMBER_FLAG_DECIMAL
The following examples show how to use
android.view.inputmethod.EditorInfo#TYPE_NUMBER_FLAG_DECIMAL .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodenameOneView.java From CodenameOne with GNU General Public License v2.0 | 4 votes |
public void setInputType(EditorInfo editorInfo) { /** * do not use the enter key to fire some kind of action! */ // editorInfo.imeOptions |= EditorInfo.IME_ACTION_NONE; Component txtCmp = Display.getInstance().getCurrent().getFocused(); if (txtCmp != null && txtCmp instanceof TextArea) { TextArea txt = (TextArea) txtCmp; if (txt.isSingleLineTextArea()) { editorInfo.imeOptions |= EditorInfo.IME_ACTION_DONE; } else { editorInfo.imeOptions |= EditorInfo.IME_ACTION_NONE; } int inputType = 0; int constraint = txt.getConstraint(); if ((constraint & TextArea.PASSWORD) == TextArea.PASSWORD) { constraint = constraint ^ TextArea.PASSWORD; } switch (constraint) { case TextArea.NUMERIC: inputType = EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_SIGNED; break; case TextArea.DECIMAL: inputType = EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL; break; case TextArea.PHONENUMBER: inputType = EditorInfo.TYPE_CLASS_PHONE; break; case TextArea.EMAILADDR: inputType = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; break; case TextArea.URL: inputType = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_URI; break; default: inputType = EditorInfo.TYPE_CLASS_TEXT; break; } editorInfo.inputType = inputType; } }