I am working on a AutoCompleteTextView
. I get some results when the users type in the AutoCompleteTextView
and these are mandatory to select.
But the problem is the drop down automatically dismisses when clicking on anywhere in the srceen.
I want to avoid this.
Is there any way I can achieve this.
Thanks.
Only reflexion in
public class CustomAutoCompleteTextView extends AutoCompleteTextView
, but - maybe this not a good solution tootry the code below.
I am using the the AutoCompleteText to auto complete the location where the user is currently in, the locationList is nothing but an array that i wrote in the strings.xml file, so use your own string array here.
and below is the code for validating the text input in the location field, the fixText() method prevent the user from typing text that does not exist in your string array, for instance: if the user type "germany" which does not exist in your string array list, it will be replaced by " " which is an empty string inside your edittext input field