((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).
hideSoftInputFromWindow(MyActivity.this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
MyActivity是目前的Activity
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).
hideSoftInputFromWindow(editview.getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);
editview是輸入框