private InputMethodManager mInputMethodManager; mInputMethodManager = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE); EditText tv = (EditText)findViewById(R.id.testEdit); tv.setOnFocusChangeListener(new OnFocusChangeListener(){ public void onFocusChange(View arg0, boolean arg1) { if(arg0.isFocused()){ mInputMethodManager.showSoftInput(arg0, 0); } else{ mInputMethodManager.hideSoftInputFromWindow(arg0.getWindowToken(), 0); } }});