Android Input Method Manager to get only number keypad

We use

InputMethodManager imPharamcy = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imPharamcy .toggleSoftInput(0, InputMethodManager.SHOW_IMPLICIT); 

to force the keyboard hard. But the keyboard is not only the keyboard. How can I get only keyboard numbers using InputMethod Manager.

In xml I already gave

  android:inputType="phone" android:imeOptions="actionNext" 

editText accepts only numbers Strange in the emulator there is only a keyboard with a number, but on phone numbers and a special keyboard charators comes

+4
source share
1 answer

See below code:

  // TYPE_CLASS_NUMBER: Class for numeric text. This displays the numbers/symbols keyboard. editText.setInputType(InputType.TYPE_CLASS_NUMBER); // TYPE_CLASS_PHONE: Class for a phone number. This displays the phone number keypad. editText.setInputType(InputType.TYPE_CLASS_PHONE); 

I hope you understand.

+4
source

All Articles