Unit -3 Auto Complete Text View and Multi Auto Complete Text View



Lesson Plan: Unit - 03
Subject: P15A2AAD - Android Application Development
Topic of Study: Displaying Text with auto and multi auto complete text view.
Grade/Level: Master of Computer Applications
Objective: To understand the mechanism of Auto and Multi Auto Complete Text View.
Time Allotment: 55 Minutes

  • AutoCompleteTextView  and MultiAutoCompleteTextView
    • There are two forms of auto-complete. 
    • One is the more standard style of filling in the entire text entry based on what the user types. 
    • If the user begins typing a string that matches a word in a developer-provided list, the user can choose to complete the word with just a tap.
    • This is done through the AutoCompleteTextView control.
    • Exa.


    • The second method allows the user to enter a list of items, each of which has autocomplete functionality.
    • Exa.
    • These items must be separated in some way by providing a Tokenizer to the MultiAutoCompleteTextView object that handles this method.
    • A common Tokenizer implementation is provided for comma-separated lists and is used by specifying the MultiAutoCompleteTextView. CommaTokenizer object.
  • Demo code of Auto Complete Text View
    • Here is the layout resource definition for this AutoCompleteTextView control:
    • Exa.


    • First, you can choose when the completion drop-down list shows by filling in a value for the completionThreshold attribute. 
    • In this case, we set it to a single character, so it displays immediately if there is a match.
    • The default value is two characters of typing before it displays auto-completion options. 
    • Second, you can set some text in the completionHint attribute.
    • This displays at the bottom of the drop-down list to help users. 
    • Sample Code of .java file.
    • Exa.
  • Demo code of Multi Auto Complete Text View
    • Finally, the drop-down list for completions is sized to the TextView.
    • This means that it should be wide enough to show the completions and the text for the completionHint attribute.
    • The MultiAutoCompleteTextView is essentially the same as the regular auto-complete, except that you must assign a Tokenizer to it so that the control knows where each autocompletion should begin.
    • Sample of .java file. 
    • Exa.

Thanks a lot for query or your valuable suggestions related to the topic.

Previous Post Next Post

Contact Form