AutoCompleteTextView Application

AutoCompleteTextView application is same like as google search. When you type in google textbox, it give some suggestion automatically. This application same as Google Search.

Step 1.

Create new application with any name from file menu option.
File → New Project → Application name → select API → Add Blank Activity → Activity Name → finish

Step 2.

In activity_main.xml layout file design your application.
Add following Controls:-

autocomplete textview

Step 3.

Import Package and write following coding in class file

    import android.widget.ArrayAdapter;
    import android.widget.AutoCompleteTextView;
    import android.widget.TextView;

	public class MainActivity extends ActionBarActivity {

    AutoCompleteTextView at;
    String name[]={"Akhtar","Akash","Arshi","Akhtar","Manzar","Mandeep","Manpreet"};
    protected void onCreate(Bundle savedInstanceState) {
        ArrayAdapter ad=new ArrayAdapter(this,android.R.layout.simple_List_item_1,name);

Step 4. Final Output

Finally run your application. Type any name in textbox field which you have set in string.

autocomplete textview
Advertisement here

Share this Page.