Added in API level 1

MultiAutoCompleteTextView


open class MultiAutoCompleteTextView : AutoCompleteTextView
kotlin.Any
   ↳ android.view.View
   ↳ android.widget.TextView
   ↳ android.widget.EditText
   ↳ android.widget.AutoCompleteTextView
   ↳ android.widget.MultiAutoCompleteTextView

An editable text view, extending AutoCompleteTextView, that can show completion suggestions for the substring of the text where the user is typing instead of necessarily for the entire thing.

You must provide a Tokenizer to distinguish the various substrings.

The following code snippet shows how to create a text view which suggests various countries names while the user is typing:

public class CountriesActivity extends Activity {
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.autocomplete_7);
 
          ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                  android.R.layout.simple_dropdown_item_1line, COUNTRIES);
          MultiAutoCompleteTextView textView = findViewById(R.id.edit);
          textView.setAdapter(adapter);
          textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
      }
 
      private static final String[] COUNTRIES = new String[] {
          "Belgium", "France", "Italy", "Germany", "Spain"
      };
  }

Summary

Nested classes
open

This simple Tokenizer can be used for lists where the items are separated by a comma and one or more spaces.

abstract

Inherited XML attributes
Inherited constants
Public constructors

MultiAutoCompleteTextView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

MultiAutoCompleteTextView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open Boolean

Instead of filtering whenever the total length of the text exceeds the threshhold, this subclass filters only when the length of the range from Tokenizer.findTokenStart to getSelectionEnd meets or exceeds getThreshold.

open CharSequence!

open Unit

Instead of validating the entire text, this subclass method validates each token of the text individually.

open Unit

Sets the Tokenizer that will be used to determine the relevant range of the text where the user is typing.

Protected methods
open Unit
performFiltering(text: CharSequence!, keyCode: Int)

Instead of filtering on the entire contents of the edit box, this subclass method filters on the range from Tokenizer.findTokenStart to getSelectionEnd if the length of that range meets or exceeds getThreshold.

open Unit
performFiltering(text: CharSequence!, start: Int, end: Int, keyCode: Int)

Starts filtering the content of the drop down list.

open Unit

Performs the text completion by replacing the range from Tokenizer.findTokenStart to getSelectionEnd by the the result of passing text through Tokenizer.terminateToken.

Inherited functions