I am using AutoComplete widget. It works fine for two characters search but doesen’t work for one character. I want to auto complete work even when user enters only one character.
For example when I enter “1” it should show all list start with “1”.
Now its showing suggestions list for 2 characters for example “12”.
Code:
zip.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
String url = "xxxxxxxxxxxxxxxxxxxxxxx";
String from = "zip";
new GetAutoComplete(url, from).execute();// getting list
}
}
});
ArrayAdapter<Integer> aa = new ArrayAdapter<Integer>(
MyActivity.this, R.layout.list_item_of_zip,
zip_codes);
zip.setAdapter(aa); // zip = autocomplete widget and zip_codes = arrayList
Set your completionThreshold to 1.
Or to do it dynamically use
mAutoCompleteTextView.setThreshold(1).http://developer.android.com/reference/android/widget/AutoCompleteTextView.html