📜  MultiAutoComplete -Android - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:50.850000             🧑  作者: Mango

代码示例4
private MultiAutoComplete multiAutoComplete = null; // A field in your Activity / Fragment class, initialize it to null.

void initAutoSuggestions() {
  
ArrayList someList = getUsers(); // <--- suggestions dataset depending on your code.
        AutoCompleteTypeAdapter nameTypeAdapter =
            AutoCompleteTypeAdapter.Build.from(new MucUserViewBinder(), new MucUserTokenFilter());


        nameTypeAdapter.setItems(someList);

        this.multiAutoComplete = new MultiAutoComplete.Builder()
            .tokenizer(new PrefixTokenizer('@'))
            .addTypeAdapter(nameTypeAdapter)
            // .delayer(constraint -> { return 10; }) // eta ki bujhi ni
            .build();
        
        this.multiAutoComplete.onViewAttached(binding.textinput); // binding.textinput is your multiAutoCompleteView 
}