1

How can I open Android's numeric keyboard programmatically?

I know how to set the EditText to numeric and initiate numeric keyboard but I want a solution without EditText or Layout because I am trying to open the keyboard for Webview.

Cœur
  • 34,719
  • 24
  • 185
  • 251
LAX_DEV
  • 1,881
  • 1
  • 15
  • 27
  • I guess it has to be done from the html of the web page. Or you could check [this](https://stackoverflow.com/questions/3372380/how-to-force-keyboard-with-numbers-in-mobile-website-in-android) – SripadRaj Jul 28 '17 at 10:19
  • @SripadRaj I tried to set .focus() in HTML Jquery but that did not open the keypad – LAX_DEV Jul 28 '17 at 11:03
  • Have you achieved what you wanted? I am also trying to do this for a custom view (which inherits View) but I am having no success :/ – Augusto Carmo Jul 12 '21 at 20:27

1 Answers1

-2

Try this

EditText etxt = new EditText(this);

etxt.setInputType(InputType.TYPE_CLASS_NUMBER);
Sathish
  • 33
  • 4