Now, I try to hide the softkeyboard when user touch outside the keyboard:
((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(
I faced exactly the same problem, while writing OnPageChangeListener within an Activity. You can use one of these solutions. Either:
OnPageChangeListener
getWindow().getDecorView().getRootView().getWindowToken()
or:
findViewById(android.R.id.content).getWindowToken()