0

I've read through the docs and searched on here, but I'm not quite understanding how all the pieces fit together. Was wondering if anyone has a clear explanation of how to grab a single column of data from Contacts and have it populate an autocomplete box.

Carl Manaster
  • 39,912
  • 17
  • 102
  • 155
Eno
  • 10,730
  • 18
  • 53
  • 86
  • Check [this link](http://stackoverflow.com/questions/2628702/android-autocomplete-with-contacts), duplicate post – fedj Aug 10 '10 at 21:20

1 Answers1

0

In onCreate():

  1. Created a SimpleCursor to create a managed query into the contacts database:

    Cursor emailAddressCursor = managedQuery(Contacts.ContactMethods.CONTENT_EMAIL_URI, PROJECTION, null, null, Contacts.ContactMethods.DATA + " ASC");

  2. Created a SimpleCursorAdapter to connect data to the cursor.

  3. Implemented setFilterQueryProvider() in my adapter to return a managed query when constraint is passed in when filtering.

  4. The final step is to call setAdapter() on the TextView passing in your adapter.

Community
  • 1
  • 1
Eno
  • 10,730
  • 18
  • 53
  • 86