How to Show/Hide Soft Keyboard Programmatically
To Show :
Show Soft Keyboard when click edit text box.
EditText objEdtTxt = (EditText) findViewById(R.id.YourEdtTextID); InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);mgr.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
To Hide :
Hide Soft Keyboard method ,This method you can use any where in your application for example Layout Click Event ,Button Click Event etc...
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(YourEdtTextObj.getWindowToken(), 0);
mgr.hideSoftInputFromWindow(YourEdtTextObj.getWindowToken(), 0);
No comments:
Post a Comment