Android AutoCompleteTextView

Email this to someonePrint this pageShare on Google+0Share on Facebook6Tweet about this on TwitterShare on LinkedIn1Share on Reddit0Pin on Pinterest0Share on StumbleUpon1
  • Android AutoCompleteTextView completes the word based on the reserved words, so no need to write all the characters of the word.
  • Android AutoCompleteTextView is a editable text field, it displays a list of suggestions in a drop down menu from which user can select only one suggestion or value.
  • Android AutoCompleteTextView is the subclass of EditText class. The MultiAutoCompleteTextView is the subclass of AutoCompleteTextView class.

Android AutoCompleteTextView Example

In this example, we are displaying the programming languages in the autocompletetextview. All the programming languages are stored in string array. We are using the ArrayAdapter class to display the array content.

The simple example of autocompletetextview in android.

activity_main.xml

Drag the AutoCompleteTextView and TextView from the pallete, now the activity_main.xml file will like this:

File: activity_main.xml

 

Activity class

Let’s write the code of AutoCompleteTextView.

File: MainActivity.java

Output:

autocompleteoutput1

Email this to someonePrint this pageShare on Google+0Share on Facebook6Tweet about this on TwitterShare on LinkedIn1Share on Reddit0Pin on Pinterest0Share on StumbleUpon1

About Team

Browse Archived Articles by Team