0

the keypad should close after selecting the name using auto complete textview we have tried the following code but unable to hide the keyboard as required

    mdidTextView = (AutoCompleteTextView) findViewById(R.id.mdid_autoSearch_editText);
    mdidTextView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
           InputMethodManager imm = (InputMethodManager) getSystemService(
                    Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(mdidTextView.getWindowToken(), 0);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });
duggu
  • 37,851
  • 12
  • 116
  • 113

1 Answers1

0

Try this

imm.hideSoftInputFromWindow(view.getWindowToken(), 0)

BTW did you try putting a break point here? Is this method even getting a call?

Naeem A. Malik
  • 995
  • 4
  • 19