Get all registered accounts from system - Android Account

Android examples for Account:Account Information

Description

Get all registered accounts from system

Demo Code


//package com.java2s;

import android.accounts.Account;
import android.accounts.AccountManager;

import android.content.Context;

public class Main {
    /**/*from w w  w  .  ja  va 2 s . c  o  m*/
     * 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);
    }
}

Related Tutorials