Search code examples
androidandroid-layoutandroid-keypad

soft keypad for 'phone edit text' dynamically


I am building an application where I want to show only numbers keypad i.e 0,1,2,3,4,5,6,7,8,9 digits dynamically.That number keypad is being used for the field name 'phone number'. I have the solution but that works in a static way..but my phone field is dynamic,now I am using

phoneText.setKeyListener(new DigitsKeyListener(true, true));

method,but this method shows total numeric soft keypad..and I want only numbers to be displayed..


Solution

  • Have you tried?

    phoneText.setInputType(InputType.TYPE_CLASS_PHONE);