Alex Rivera | Logout

Need number only soft keyboard?

Asked 2013-02-26T21:33:38.937
10

Hi I need a soft keyboard with only numeric values 0 to 9 and Enter key. Shouldn't show anything other than these like . , ( ) etc...

enter image description here

I tried several options as suggested here but nothings seems to work for me.

  1. setRawInputType(Configuration.KEYBOARD_QWERTY)
  2. setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED)
  3. setRawInputType(InputType.TYPE_CLASS_NUMBER)
  4. setRawInputType(InputType.TYPE_CLASS_PHONE)

I always have the extra characters show up on the keyboard like:

enter image description here

setRawInputType(Configuration.KEYBOARD_12KEY) shows a keyboard like this:

enter image description here

Would appreciate any help. Thanks in advance.

NOTE:

  • android:minSdkVersion="14": ICS4.0
  • android:targetSdkVersion="17": JB 4.2
Edit
Report

1 Answer

0

The keyboard itself chooses what keys to layout. The best you can do is specify InputType.TYPE_CLASS_NUMBER, but the keyboard will still display whatever it thinks is appropriate to a numeric text field.

answered 2013-02-26T21:36:56.637

Your Answer