There is a page where the user can send e-mail, sms or call its guests when needed. The problem is that when the user sends e-mail to its guest, the keyboard doesn't hide. Even-though I have a small problem solving the issue, It still seems hard to find alike post to solve it. I'll be also making screenshots and placing them in here.
As you can see, the keyboard doesn't hide after sending mail.
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(Intent.EXTRA_EMAIL,
new String[] { **EmailAddress** });
startActivityForResult(sendIntent, 1);
@Override
protected void onActivityResult(int arg0, int arg1, Intent arg2) {
super.onActivityResult(arg0, arg1, arg2);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
InputMethodManager inputManager = (InputMethodManager) activity
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(**AnyViewOfScreen**.getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}, 300);
}
It is easy just add the following code in your manifest for the desire activity:
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="keyboardHidden"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With