I want to show android soft keyboard on page load and programmatically focusing a input field.
$('#field').focus();
As far as I researched , this cannot be done other than user generated events , like click event.
So I tried a workaround to focus the input field , and show android keyboard manually by using this code.
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInputFromWindow(myWebView.getWindowToken() , InputMethodManager.SHOW_IMPLICIT , 0);
Keyboard is successfully showing and input field is also getting focus. But the problem is , it is only showing the standard keyboard. I want to show the keyboard according to the input type specified.
Like if input field is:
<input type="number" id="field" name="field"/>
Above workaround is showing standard text keyboard , but I want to show a numeric keyboard according to the type in input field.
i've searched a long time before i found solution.
Add this :
after showSoftInput.
This will "recalculate" the kind of keyboard to show regarding focused input