2

How to disable certain keys (say number/symbol keys) in Android virtual keyboard?

Specifically I want user can't input a double quote ( " ) character when virtual keyboard is showed up when user focus on a standard android EditText widget.

henrywibowo
  • 113
  • 1
  • 1
  • 7

2 Answers2

4

How to disable certain keys (say number/symbol keys) in Android virtual keyboard?

You can't, sorry. After all, the input method editor may not have "keys" in the first place.

Specifically I want user can't input a double quote ( " ) character when virtual keyboard is showed up when user focus on a standard android EditText widget.

Then you will have to block the input at the EditText, by means of an InputFilter, as is described here: How do I use InputFilter to limit characters in an EditText in Android?

Community
  • 1
  • 1
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • @Commonware, how do we disable the keys completely, i.e. the keys do not generate any key event at all. It just sits, there in the softkeyboard, as a disabled button. – Shail Adi May 08 '15 at 09:52
  • In my note 2 device : my files> create folder> ; now go for special symbols and see; some of the symbols are disabled. – Shail Adi May 08 '15 at 10:07
0

why don't you use android:inputType="..." for your EditText

http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType

ColdFire
  • 6,764
  • 6
  • 35
  • 51
  • I think he talks about specific keys. Text but without ". He also talks about "standard" android, so he might be using already `inputType` defined `EditTexts` – Sergi Juanola Jul 10 '12 at 10:49
  • 1
    yes, i use the attribute inputType, but i just can't find the suitable inputType that only for letters and numbers. But it's done now with edittext's attribute "android:digits" Thank you anyway :-) – henrywibowo Jul 11 '12 at 02:42