Reputation: 1275
How can I open Keyboard on Button click in android?
What I want to be like this:
Upvotes: 9
Views: 26378
Reputation: 7482
Please try this
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
Upvotes: 34
Reputation: 128428
Write this code inside the Button click event to TOGGLE the keyboard:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
Upvotes: 3
Reputation: 1584
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(view, flags)
an example may be:
InputMethodManager imm = (InputMethodManager) RouteMapActivity.this
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(mapView, InputMethodManager.SHOW_IMPLICIT);
Upvotes: 10