Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.List; import android.accounts.Account; import android.accounts.AccountManager; import android.content.Context; public class Main { public static List<Account> getGoogleAccounts(Context context) { List<Account> list = new ArrayList<Account>(); Account[] accounts = AccountManager.get(context).getAccounts(); for (int i = 0; i < accounts.length; i++) { Account account = accounts[i]; if (account.type.equals("com.google")) { list.add(account); } } return list; } }