Skip to content Skip to sidebar Skip to footer

How To Open Keyboard On Button Click In Android?

How can I open Keyboard on Button click in android? What I want to be like this:

Solution 1:

Please try this

InputMethodManagerimm= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);

Solution 2:

InputMethodManagerimm= (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);

imm.showSoftInput(view, flags)

an example may be:

InputMethodManagerimm= (InputMethodManager) RouteMapActivity.this
    .getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(mapView, InputMethodManager.SHOW_IMPLICIT);

Solution 3:

Write this code inside the Button click event to TOGGLE the keyboard:

InputMethodManagerimm= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);

Post a Comment for "How To Open Keyboard On Button Click In Android?"