How to hide the Android Soft Keyboard

0

I have a EditText View and I want to hide Android Virtual keyboard whenever the EditText View does not has focus

Answered question
0

In android you can use InputMethodManager to hide a virtual keyboard. A simple code sample is shown below.

EditText editText = (EditText) findViewById(R.id.editText);  
InputMethodManager inputMethod = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethod.hideSoftInputFromWindow(editText.getWindowToken(), 0);
0

You can also get the complete source code from the example code here – https://inducesmile.com/android-programming/how-to-close-or-hide-soft-keyboard-in-android/

Changed status to publish

50% Discounts On Projects

Do you have a custom project with a clear requirements, we are currently giving a 50% discount on all projects.

We will work with you to ensure we deliver what you need.

If you have questions or want to chat with us, you can reach us on Skype (henry.tochi)

Languages and technologies we use - Java, Kotlin, Laravel, Vue, React, Flutter, Swift and more.