1. Open the input method window:
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
// Accept the edited text or other views input by the soft keyboard
Imm. showsoftinput (submitbt, inputmethodmanager. show_forced );
Ii. Close the input entry window
Inputmethodmanager = (inputmethodmanager)
Getsystemservice (context. input_method_service); inputmethodmanager. hidesoftinputfromwindow (opelistactivity. this. getcurrentfocus (). getwindowtoken (), inputmethodmanager. hide_not_always); // accepts the edited text or other views input by the keypad. showsoftinput (submitbt, inputmethodmanager. show_forced );
3. If the input method is enabled, the function is disabled. If the input method is not enabled, the function is enabled.
InputMethodManager m=(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);m.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
4. obtain the status of the input method.
Inputmethodmanager Imm = (inputmethodmanager) getsystemservice (context. input_method_service); Boolean isopen = Imm. isactive (); If isopen returns true, it indicates that the input method is enabled.
Example:
Config. Java
public static void showSoftInput(final EditText edittext) { Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { InputMethodManager inputManager = (InputMethodManager) edittext.getContext().getSystemService( Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(edittext, 0); } }, 400); }
Xxactivity. Java
Config.showSoftInput(etUserName);
Input box and keyboard pop-up (input method status and Control)