Created
August 14, 2013 02:30
-
-
Save Mrono/6227537 to your computer and use it in GitHub Desktop.
List google accounts for android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String[] getGoogleAccounts() { | |
ArrayList<String> accountNames = new ArrayList<String>(); | |
Account[] accounts = AccountManager.get(this).getAccounts(); | |
for (Account account : accounts) { | |
if (account.type.equals("com.google")) { | |
accountNames.add(account.name); | |
} | |
} | |
String[] result = new String[accountNames.size()]; | |
accountNames.toArray(result); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment