Android examples for Account:Account Information
has Account
//package com.java2s; import android.accounts.Account; import android.accounts.AccountManager; import android.content.Context; import android.text.TextUtils; public class Main { public static boolean hasAccount(Context context, Account currentAccount, String accountType) { if (context == null || TextUtils.isEmpty(accountType)) { return false; }//from w w w. j a v a2s . c om AccountManager manager = AccountManager.get(context); Account[] accounts = manager.getAccountsByType(accountType); if (accounts == null) { return false; } for (Account account : accounts) { if (currentAccount.equals(account)) { return true; } } return false; } }