Reputation: 3672
I've an editBox whose property is set to android:inputType="number"
. Now, if I exclusively touch the editBox, I get numberkeyboard. But when programatically I make focus, then qwerty keyboard appears.
InputMethodManager m = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
shows the simple qwerty keyboard. What if I want to open the number keyboard ?
Upvotes: 1
Views: 196
Reputation: 62419
To show the keyboard:
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(viewToEdit, 0);
To hide the keyboard:
if (getCurrentFocus() != null) {
inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getApplicationWindowToken(), 0);
}
Upvotes: 1