Android调用系统软键盘

/**

 * 

 * @MethodName:closeInputMethod

 * @Description:关闭系统软键盘

 * @throws

 */

public void closeInputMethod(){

try {

((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))

.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),

InputMethodManager.HIDE_NOT_ALWAYS);

catch (Exception e) { }finally{ }

}

/**

 * 

 * @MethodName:openInputMethod

 * @Description:打开系统软键盘

 * @throws

 */

public void openInputMethod(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);

}

}, 200);

}

原文地址:https://www.cnblogs.com/android100/p/android-soft-keyboard.html