Now, I try to hide the softkeyboard when user touch outside the keyboard:
((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(
You could just get the token from the WindowManager.LayoutParams of the window directly
WindowManager.LayoutParams
getWindow().getAttributes().token