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
  • 37,241
  • 25
  • 195
  • 267
LAX_DEV
  • 2,111
  • 3
  • 19
  • 29
  • 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