Android examples for Account:Account Information
Get number of account in android accountManager.
//package com.java2s; import android.accounts.Account; import android.accounts.AccountManager; import android.content.Context; public class Main { /**//w w w . ja va2 s . c om * Get number of account in android accountManager. * * @param context * @param accountType * @return Number of accounts */ public static Integer getNumberOfAccounts(final Context context, String accountType) { return getAccounts(context, accountType).length; } /** * Get all registered accounts from system * * @param context * @return array of accounts */ public static Account[] getAccounts(final Context context, String accountType) { return AccountManager.get(context).getAccountsByType(accountType); } }