Android AutoCompleteTextView with Custom Adapter filtering not working

I have to over-ride the getFilter() method of the Adapter Here is the code which worked for me, thanks to sacoskun public class CustomerAdapter extends ArrayAdapter<Customer> { private final String MY_DEBUG_TAG = “CustomerAdapter”; private ArrayList<Customer> items; private ArrayList<Customer> itemsAll; private ArrayList<Customer> suggestions; private int viewResourceId; public CustomerAdapter(Context context, int viewResourceId, ArrayList<Customer> items) { super(context, viewResourceId, … Read more

Show all items in AutocompleteTextView without writing text

You need to extend AutoCompleteTextView, “When threshold is less than or equals 0, a threshold of 1 is applied.”. setThreshold import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; import android.widget.AutoCompleteTextView; public class InstantAutoComplete extends AutoCompleteTextView { public InstantAutoComplete(Context context) { super(context); } public InstantAutoComplete(Context arg0, AttributeSet arg1) { super(arg0, arg1); } public InstantAutoComplete(Context arg0, AttributeSet arg1, int … Read more

Difference between MultiAutoCompleteTextView and AutoCompleteTextView

AutocompleteTextView only offers suggestions about the whole sentence and MultiAutoCompleteTextView offers suggestions for every token in the sentence. You can specify what is the delimiter between tokens. String[] words=new String[] { “word1”, “word2”, “word3”, “word4”, “word5″ }; MultiAutoCompleteTextView macTv = (MultiAutoCompleteTextView) this.findViewById(R.id.mac_tv); ArrayAdapter<String> aaStr = new ArrayAdapter<String>(this,android.R.layout.dropdown_item,words); macTv.setAdapter(aaStr); macTv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer() ); and: <MultiAutoCompleteTextView android:id=”@+id/mac_tv” android:layout_width=”fill_parent” … Read more

How do I Use AutoCompleteTextView and populate it with data from a web API?

I came up with a solution, I don’t know if it is the best solution, but it appears to work very well. What I did was created a custom adapter that extends ArrayAdapter. In the custom adapter I overrode getFilter and created my own Filter class that overrides performFiltering. This starts a new thread so … Read more