Introduction
The four types of Text Controls in Android are:
- TextView
- EditText
- AutoCompleteTextView
- MultiCompleteTextView
MultiCompleteTextView: In this, when we enter a character regarding a predefined array, this will automatically show the list of items of the array. So in this application, we will show a list of animals that we will got from the string.xml file. In MultiCompleteTextView we will show this by writing this code:
- multiAutoCompleteTextView=(MultiAutoCompleteTextView)findViewById(R.id.multiAutoCompleteTextView);
- ArrayAdapter adapter=new ArrayAdapter(this,android.R.layout.simple_dropdown_item_1line,getResources().getStringArray(R.array.ItemAraay));
- multiAutoCompleteTextView.setAdapter(adapter);
- multiAutoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
Step 1
Create a project like this:
Step 2
Create an XML file and write this:

- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- android:paddingBottom="@dimen/activity_vertical_margin"
- tools:context=".MainActivity">
- <TextView
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:text="@string/app_name"
- android:textStyle="bold"
- android:layout_centerHorizontal="true"
- android:textSize="20dp"/>
- <MultiAutoCompleteTextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:id="@+id/multiAutoCompleteTextView"
- android:completionThreshold="1"
- android:layout_marginTop="50dp"
- android:hint="enter alphabet"
- />
- </RelativeLayout>

Join the conversation! Your thoughts help the community grow.