I am dynamically updating my AutoCompleteTextView on every 3rd / 4th letter.
For some reason, about 5-10% of the time when the user types the third letter, though I know for sure I am making a valid arraylist and populating the AutoCompleteTextView, it does not show for unique cases. Something I noticed that was consistent was that the list of words that did not show up were from length 5-15 (others range 50+)
Any idea what is going ? Am I missing something about AutoCompleteTextView, where it doesn’t think showing 10 or so suggestions is worth it if the datalist is not as big? Should I add irrelevant filer data or would that impact performance? Thanks
Here is some relevant source code..
Textwatcher for text view checks that;
if (((start + count) == 3) || ((start + count) == 4)
|| ((start == 3) && (before >= 1))) {
if (!last.equals(s)) {
thread = new Thread(new AutoCompleteThread(s));
thread.start();
}
}
in my custom thread I group up words .. then i call this on my text view and adapter;
if(words.size() > 0)
{
last = s;
// adapter.clear();
// for(String e : words)
// adapter.add(e);
// adapter.notifyDataSetChanged();
adapter = new ArrayAdapter<String>(
getActivity(), android.R.layout.simple_list_item_1, words);
textView.setAdapter(adapter);
textView.showDropDown();
}
Turns out there is a weird glitch that happens very often if my dynamically loading list is very small and my original list (which comes from my RES folder) is substantially large (500 or so). It doesn’t glitch out when the dynamically loaded list is large, perhaps it gives enough time to the AutoCompleteTextView to show suggestions while loading? Not sure about that.
Anyways, the solution was to lower my original size of the arraylist in my res folder