Java tutorial
//package com.java2s; //License from project: Open Source License import android.accounts.Account; import android.accounts.AccountManager; import android.content.Context; public class Main { public static final String GOOGLE_ACCOUNT_TYPE = "com.google"; public static Account getAccount(final Context context, final String accountName) { final AccountManager manager = AccountManager.get(context); Account[] accounts = manager.getAccountsByType(GOOGLE_ACCOUNT_TYPE); for (Account account : accounts) { if (account.name.equals(accountName)) { return account; } } return null; } }