Code example for AccountManagerFuture

Methods: getResult

    private class OnTokenAcquired implements AccountManagerCallback<Bundle> {
        public void run(AccountManagerFuture<Bundle> result) {
            try { 
                // Get the result of the operation from the AccountManagerFuture. 
                Bundle bundle = result.getResult();
                // The token is a named value in the bundle. The name of the value 
                // is stored in the constant AccountManager.KEY_AUTHTOKEN. 
                String token = bundle.getString(AccountManager.KEY_AUTHTOKEN);
                Intent launch = (Intent) bundle.get(AccountManager.KEY_INTENT);
                if (launch != null) {
                    startActivityForResult(launch, 0);
            } catch (OperationCanceledException e) {
                throw new RuntimeException(e);