get Account From Account Name - Android Account

Android examples for Account:Account Name

Description

get Account From Account Name

Demo Code


//package com.java2s;
import android.accounts.Account;
import android.accounts.AccountManager;

public class Main {
    public static Account getAccountFromAccountName(
            AccountManager accountManager, String accountName) {
        Account accounts[] = accountManager.getAccounts();
        for (int i = 0; i < accounts.length; ++i)
            if (accountName.equals(accounts[i].name))
                return accounts[i];
        return null;
    }//  w  ww .  j av a  2 s  . c  o  m
}

Related Tutorials