Java tutorial
//package com.java2s; //License from project: Apache License import android.accounts.Account; import android.accounts.AccountManager; import android.content.Context; public class Main { public static final String ACCOUNT_TYPE = "com.simon.accountsample"; public static Account getAccount(Context context, String accountName) { AccountManager accountManager = AccountManager.get(context); Account[] accounts = accountManager.getAccountsByType(ACCOUNT_TYPE); for (Account account : accounts) { if (account.name.equalsIgnoreCase(accountName)) { return account; } } return null; } }