Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

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

import android.content.Context;

public class Main {
    public static Account getAccount(Context context, String type) {
        Account[] accountsByType = AccountManager.get(context.getApplicationContext()).getAccountsByType(type);
        return (accountsByType == null || accountsByType.length <= 0) ? null : accountsByType[0];
    }
}