Example usage for android.widget MultiAutoCompleteTextView setOnItemSelectedListener

List of usage examples for android.widget MultiAutoCompleteTextView setOnItemSelectedListener

Introduction

In this page you can find the example usage for android.widget MultiAutoCompleteTextView setOnItemSelectedListener.

Prototype

public void setOnItemSelectedListener(AdapterView.OnItemSelectedListener l) 

Source Link

Document

Sets the listener that will be notified when the user selects an item in the drop down list.

Usage

From source file:TIG055st2014.mailmaster.Activities.ComposeActivity.java

/**
 * Function used to configure the various MultiAutoCompleteTextViews (the autocomplete suggestions list that shows up when
 * writing in the to/cc/bcc fields)./*from   w w w  .j a va  2s .  com*/
 */
private void setupAC(final MultiAutoCompleteTextView ma, ArrayAdapter<String> adapter) {
    ma.setAdapter(adapter);
    ma.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    //How many letters needed to start showing suggestions.
    ma.setThreshold(0);
    ma.setOnTouchListener(new View.OnTouchListener() {
        //Making sure suggestions are shown directly.
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            ma.showDropDown();
            return false;
        }
    });
    ma.setOnItemSelectedListener(this);
}