I’ve have a Vector like this in my app:
Vector<Firm> firmVector= new Vector<Firm>();
As you may see, this is a vector of objects from my own class Firm
So to my question, is it possible to add a AutoComplete to this `Vector?
Like this one, from developer.android.com:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AutoCompleteTextView textView = (AutoCompleteTextView)findViewById(R.id.autocomplete_country);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item, COUNTRIES);
textView.setAdapter(adapter);
}
Yes, you can do it by implementing an ArrayAdapter, but you’ll need to implement the
getFilter()which is used by theAutoCompleteTextView. Something similar to this might work:I ripped this out of a project I have, so it will need some testing and cleanup to get working (in my case I have a Filter on a set of
JSONObjectinstances, where you have aFirm) but try something like that. The comments withCUSTOMIZE THISare where you want to actually perform the test based on the input into theAutoCompleteTextView.