List of usage examples for android.accounts AccountManager setPassword
public void setPassword(final Account account, final String password)
From source file:Main.java
/** * Sets password of account, creates a new account if necessary. *///w w w . j av a 2 s . c o m private static Account findOrCreateAccount(AccountManager accountManager, String username, String refreshToken, String accountType) { for (Account account : accountManager.getAccountsByType(accountType)) { if (account.name.equals(username)) { accountManager.setPassword(account, refreshToken); return account; } } Account account = new Account(username, accountType); accountManager.addAccountExplicitly(account, refreshToken, null); return account; }