0

I want to permanently disable the soft-keyboard from appearing in a fragment in android.

In my scenario there are three fragments that is integrated to a viewpager in an activity.

When i reach the second fragment which only contains a spinner. On spinner dropdown the keyboard appears.

Have tried all solutions in stack overflow yet nothing was successful.

Please help me to permanently disable the keyboard from appearing in the Second fragment

Please keep in mind this is a tablet application.

Amal p
  • 2,882
  • 4
  • 29
  • 49

1 Answers1

0

Could you please share what you tried?

Did this not work for you - link

Code:

    @Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(getView().getWindowToken(), 0);
}
Niso
  • 79
  • 10