0

I have a webview based app in which i want the appropriate keypad to open whenever i give focus to some input. With the code i have provided below it opens up but it always opens qwerty keypad even for numeric type inputs.

private void ShowKeyboard(final boolean show) {
    try {
        runOnUiThread(new Runnable() {
             @Override
             public void run() {
                 if (show) {
                      InputMethodManager mgr = (InputMethodManager) General.MainShellReference.getSystemService(Context.INPUT_METHOD_SERVICE);
                      mgr.showSoftInput(General.appView, InputMethodManager.SHOW_IMPLICIT);
                      ((InputMethodManager) General.MainShellReference.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(General.appView, 0);
                    } else {
                        getWindow().setSoftInputMode(
                                WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
                    }
            }
        });

    } catch (Exception ex) {
        ;
    }
}
Syed Wajahat Ali
  • 541
  • 1
  • 7
  • 25

1 Answers1

0

I think you have already tried to use <input type="number" /> and <input type="tel" />. Anyway try to do this.

Did you see this: Is there a way to have a masked numeric input field? http://blog.pamelafox.org/2012/05/triggering-numeric-keyboards-with-html5.html

Community
  • 1
  • 1
QArea
  • 4,955
  • 1
  • 12
  • 22
  • thanks for the reply but my problem here is that my keyboard is being openned forcefully and it opens qwerty. If i tap on the text field it will open correct one but not when its being openned forcefully – Syed Wajahat Ali Nov 17 '14 at 12:50