Android examples for Account:Account Information
get Account from AccountManager
//package com.java2s; import android.accounts.Account; import android.accounts.AccountManager; import android.content.Context; public class Main { public static Account getAccount(Context context, String pattern, int i) { AccountManager accountManager = AccountManager.get(context); if (accountManager != null) { Account[] accounts = accountManager.getAccountsByType(pattern); if (accounts != null && accounts.length > i && accounts[i] != null) { return accounts[i]; }//from w ww .ja v a 2s .c om } return null; } }