1.Get an instance of AccountManager using get(activity).
public void GetGmailUsername(Activity activity) {
AccountManager accmanager = AccountManager.get(activity);
Account[] accounts = accmanager .getAccountsByType("com.google");
List<String> Usernamelists = new LinkedList<String>();
for (Account account : accounts) {
Usernamelists .add(account.name);
}
System.out.println("Usernamelists --"+Usernamelists );
}
No comments:
Post a Comment