I get a null pointer exception at this row:
public void hideKeyboard(){
InputMethodManager inputManager = (InputMethodManager)
this.
It can show error if instance of InputMethodManager is null. Try the below code it worked for me.
void hideKeyboard() {
InputMethodManager inputManager = (InputMethodManager)
getActivity().getSystemService(
Context.INPUT_METHOD_SERVICE);
View focusedView = getActivity().getCurrentFocus();
if (focusedView != null) {
try{
assert inputManager != null;
inputManager.hideSoftInputFromWindow(focusedView.getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}catch(AssertionError e{
e.printStackTrace();
}
}
}