AutoCompleteTextView doesn't show dropdown, got warning
android, autocompletetextview
Solution
The warning comes from the following code snippet in `ArrayAdapter.performFiltering(CharSequence)`:
String prefixString = prefix.toString().toLowerCase(); // entered by user
final ArrayList<T> values = mOriginalValues;
final int count = values.size();
final ArrayList<T> newValues = new ArrayList<T>(count); // this will be returned
for (int i = 0; i < count; i++) {
final T value = values.get(i); // in your case, 'value' is null at times
final String valueText = value.toString().toLowerCase(); // the warning
// First match against the whole, non-splitted value
if (valueText.startsWith(prefixString)) {
newValues.add(value);
} else {
final String[] words = valueText.split(" ");
final int wordCount = words.length;
for (int k = 0; k < wordCount; k++) {
if (words[k].startsWith(prefixString)) {
newValues.add(value);
break;
}
}
}
}
So, check for `null` values in `names`.
Problem
I have an ArrayList with 60-70 elements in it. I set an adapter to the AutoCompleteTextView as follows. ``` AutoCompleteTextView mRecipient = (AutoCompleteTextView) this.findViewById(R.id.recipient); mRecipient.setThreshold(1); Log.i("Array list", ""+names);// Here I got the arrayList ArrayAdapter<String> nameadapter=new ArrayAdapter<String>(MyClass.this, android.R.layout.simple_list_item_1, names); mRecipient.setAdapter(nameadapter); ``` But the dropdown list doesn't show up and I got some warning(Not errror) in Logcat. ``` 04-21 17:15:53.017: W/Filter(15093): An exception occured during performFiltering()! 04-21 17:15:53.017: W/Filter(15093): java.lang.NullPointerException 04-21 17:15:53.017: W/Filter(15093): at android.widget.ArrayAdapter$ArrayFilter.performFiltering(ArrayAdapter.java:437) 04-21 17:15:53.017: W/Filter(15093): at android.widget.Filter$RequestHandler.handleMessage(Filter.java:234) 04-21 17:15:53.017: W/Filter(15093): at android.os.Handler.dispatchMessage(Handler.java:99) 04-21 17:15:53.017: W/Filter(15093): at android.os.Looper.loop(Looper.java:123) 04-21 17:15:53.017: W/Filter(15093): at android.os.HandlerThread.run(HandlerThread.java:60) ``` Also I have a ListView below this, which is empty now. Can anybody figure out what this warning means?