Skip to content

Instantly share code, notes, and snippets.

@jdamcd
Last active December 12, 2015 07:48
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jdamcd/4738788 to your computer and use it in GitHub Desktop.
Save jdamcd/4738788 to your computer and use it in GitHub Desktop.
Email adapter for AutoCompleteTextView
private ArrayAdapter<String> getEmailAddressAdapter(Context context) {
Account[] accounts = AccountManager.get(context).getAccountsByType("com.google");
String[] addresses = new String[accounts.length];
for (int i = 0; i < accounts.length; i++) {
addresses[i] = accounts[i].name;
}
return new ArrayAdapter<String>(context, android.R.layout.simple_dropdown_item_1line, addresses);
}
@orrc
Copy link

orrc commented Feb 12, 2013

Nice.. I came here to suggest exactly the same things, but they're already implemented! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment