public static boolean updateAccount(final Account account,
            final Activity activity) {
        int count = UPDATE_COUNT.get();
        synchronized (UPDATE_COUNT) {
            // Don't update the account if the account was successfully updated
            // while the lock was being waited for
            if (count != UPDATE_COUNT.get()) {
                return true;
            }

            AccountManager manager = AccountManager.get(activity);
            try {
                if (!hasAuthenticator(manager)) {
                    throw new AuthenticatorConflictException();
                }
                manager.updateCredentials(account, ACCOUNT_TYPE, null,
                        activity, null, null).getResult();
                UPDATE_COUNT.incrementAndGet();
                return true;
            } catch (OperationCanceledException e) {
                Log.d(TAG, "Excepting retrieving account", e);
                activity.finish();
                return false;
            } catch (AccountsException e) {
                Log.d(TAG, "Excepting retrieving account", e);
                return false;
            } catch (AuthenticatorConflictException e) {
                activity.runOnUiThread(() -> showConflictMessage(activity));
                return false;
            } catch (IOException e) {
                Log.d(TAG, "Excepting retrieving account", e);
                return false;
            }
        }
    }
Update account

@param account
@param activity
@return true if account was updated, false otherwise
app/src/main/java/com/github/pockethub/android/accounts/AccountUtils.java