In this post we look into the auto complete text view and how it will be used in your app.
Steps 1)Include the Auto-complete Text-view in your XML as following:-
<AutoCompleteTextView
android:id="@+id/txt_autoview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:text=""
android:textColor="#000000"
/>
Steps 2)Implements an interface as following:-
public class Depots extends Activity implements TextWatcher {
AutoCompleteTextView txt_market;
List<String> market;
}
Steps 3)Add the following in your onCreate():-
market = new ArrayList<String>();
txt_market = (AutoCompleteTextView) findViewById(R.id.txt_autoview);
//Before you setting an adapter to the textview you have to add an items to the arraylist.
txt_market.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, market));
Steps 4)Add the Unimplemented methods for your Text Watcher interface.
Thanks..
Steps 1)Include the Auto-complete Text-view in your XML as following:-
<AutoCompleteTextView
android:id="@+id/txt_autoview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:text=""
android:textColor="#000000"
/>
Steps 2)Implements an interface as following:-
public class Depots extends Activity implements TextWatcher {
AutoCompleteTextView txt_market;
List<String> market;
}
Steps 3)Add the following in your onCreate():-
market = new ArrayList<String>();
txt_market = (AutoCompleteTextView) findViewById(R.id.txt_autoview);
//Before you setting an adapter to the textview you have to add an items to the arraylist.
txt_market.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, market));
Steps 4)Add the Unimplemented methods for your Text Watcher interface.
Thanks..


