Android block EditText soft keyboard method

  • 2020-06-23 01:57:13
  • OfStack

An example of Android shielding EditText soft keyboard is presented in this paper. Share to everybody for everybody reference. The details are as follows:

The java code is as follows:


InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEdit.getWindowToken(), 0);
//myEdit Is your EditText object 

You can restore the display by:


boolean showSoftInput(View view, int flags, ResultReceiver resultReceiver)
boolean showSoftInput(View view, int flags)
void showSoftInputFromInputMethod(IBinder token, int flags)

Hopefully, this article has helped you with your Android programming.


Related articles: