Quick guide to quick autocomplete textview

SDK Version: 

This demo shows how to speed up the original autocomplete textview assuming that we can work with ordered data.

Let's prepare a simple test environment, which demostrate the difference between the two versions. Then let's generate a few thousand test data, and create two textviews from which we will speed up the second one.

  1. public class Main extends Activity {
  2.         AutoCompleteTextView mAutoCompleteTextViewOriginal;
  3.         AutoCompleteTextView mAutoCompleteTextViewQuick;
  5.         @Override
  6.         public void onCreate(Bundle savedInstanceState) {
  7.                 super.onCreate(savedInstanceState);
  8.                 setContentView(R.layout.main);
  10.                 String[] values =  createLongSortedStringArray(4);
  12.                 mAutoCompleteTextViewOriginal = (AutoCompleteTextView) findViewById(;
  13.                 ArrayAdapter<String> originalAdapter = new ArrayAdapter<String>(this, R.layout.autocomplete_listitem, values);
  14.                 mAutoCompleteTextViewOriginal.setAdapter(originalAdapter);

Syndicate content