/**
* Updates account list spinner when the list of Accounts on the system changes. Satisfies OnAccountsUpdateListener implementation.
*
* @param accounts
*/
@Override
public void onAccountsUpdated(Account[] accounts) {
LogUtils.i("Account list update detected");
// Clear out any old data to prevent duplicates.
mAccounts.clear();
// Get account data from system
AuthenticatorDescription[] accountTypes = AccountManager.get(getContext()).getAuthenticatorTypes();
// Populate tables
for (int i = 0; i < accounts.length; i++) {
// The user may have multiple accounts with the same name, so we need to construct a meaningful display name for each.
String systemAccountType = accounts[i].type;
AuthenticatorDescription ad = getAuthenticatorDescription(systemAccountType, accountTypes);
AccountData data = new AccountData(accounts[i].name, ad);
mAccounts.add(data);
}
// Update the account spinner
mAccountAdapter.notifyDataSetChanged();
}
ContactAdderFragment.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:asstudydemo
作者:
评论列表
文章目录