Code example for AccountManager

Methods: addAccount

                public void run(AccountManagerFuture<Bundle> result) {
                    onAccountCreationFinished(actionContext, loginCallback, result);
            accountManager.addAccount(MANAGED_ACCOUNT_TYPE, AUTH_TOKEN_TYPE, null, null, actionContext.getActivity(), c, null);
        } else { 
            if (!wasLastLoginWithCredentials()) { 
            credentialsAccountHandler.promptAccount(actionContext, loginCallback);
    private void onAccountCreationFinished(final ActionContext actionContext, LoginCallback loginCallback,
                                           AccountManagerFuture<Bundle> result) {
        assert result.isDone();
        try { 
            final Bundle b = result.getResult();
            authenticate(loginCallback, new Account(
Connect your IDE to all the code out there  Get Codota for Java