1. Introduction :


When ever we need to enter any word and a suggestion pop’s up below we feel much more easy and enjoy typing in mobile especially when we are busy in chatting this process most of them use this suggestion turned on.

So, now a similar mechanism we will be implementing in our app i.e., AutoCompleteTextView the name gives the complete description about what we are going to do……

We will be getting necessary suggestion from the TextView while we are entering the text / word.And one more thing i want to specify here is that we will not be using regular TextView here but a similar type of view which is called as to be AutoCompleteTextView, yes its the name of the text input we are going to use it here in autocompletetextview in android tutorial.


2. Creating activity_main.xml :


In this tutorial we will be using a textview which appears to be a normal text view but its got a feature to show suggestions as we type on So lets see it first,



Yes that’s it we gonna need here but in a formal way look at full code.



And then here comes our java code where we will be going to use the above textview to get the suggestion shown up.

3. Creating MainActivity.java :

Initialize the AutoCompleteTextView



Then we will be using a String Array to set some data and attach it to textview so that it will show up in suggestions.



So now we will be binding the data to the AutoCompleteTextView using a android autocompletetextview arrayadapter



Full CodeĀ  for MainActivity.java


4. Output :


autotextview1 autotextview2

Show Buttons
Hide Buttons
Read previous post:
Android replace a string by another