In AutoCompleteTextView, On focusChangeListener() showDropDown is not working only in Android Oreo devices and showing the error message "android.view.WindowManager$BadTokenException: Unable to add window — token android.os.BinderProxy@f2a625f is not valid; is your activity running ?"
googlePlaceAutocompleteAdapter = new googlePlaceAutocompleteAdapter(getApplicationContext(),android.R.layout.simple_list_item_1, this,list);
search_place.setAdapter(googlePlaceAutocompleteAdapter);
search_place.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
search_place.showDropDown();
}
}
});
search_place is my autoCompleteTextView and I am attaching googlePlaceAutoCompleteAdapter. The list contains places which I want to display before the user enters any text.