Search code examples
androiduser-controlsuser-inputaddressbooktype-ahead

Predictive input/type-ahead for email address input, based on user's contacts?


In Android Google Mail app, when you start typing into the "To:" field in a new email, you will get a dropdown menu, auto-populated from your contacts.

I want this behavior in my app.

Currently, when my users enter an email address, they have to type the whole thing (into, essentially, an "textEmailAddress" input field). I want to make things easier by providing contacts-based predictive entry, Google-Mail-style.

How do I do this?

(So far, I have 1. googled, 2. looked through Android SDK documentation, 3. looked through Android sources (http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android/).)


Solution

  • You have 2 things to do

    1) Get All Contact's Email ID See this Blog and Also can Search for more exapmles After getting the Email IDs Store them in An Array say emailArray

    2) Use the emailArray to show in an AutoCompleteTextView