EDIT : Seems I\'m not making myself clear. What I need is a way to hide the soft keyboard whenever i replace the fragment I am in. How do I go about doing this ?
programmatically you could use, capturing the view of the active activity on the screen of the device.
public final void onTabReselected(Tab tab, FragmentTransaction fragmentTransaction) {
View focus = getCurrentFocus();
if (focus != null) {
hiddenKeyboard(focus);
}
}
public final void onTabselected(Tab tab, FragmentTransaction fragmentTransaction) {
View focus = getCurrentFocus();
if (focus != null) {
hiddenKeyboard(focus);
}
}
public final void onTabUnselected(Tab tab, FragmentTransaction fragmentTransaction) {
View focus = getCurrentFocus();
if (focus != null) {
hiddenKeyboard(focus);
}
}
private void hiddenKeyboard(View v) {
InputMethodManager keyboard = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
keyboard.hideSoftInputFromWindow(v.getWindowToken(), 0);
}