Pri*_*off 10 java icons android user-accounts accountmanager
每个帐户的帐户设置中都会显示一个图标.对于Google帐户,有一个图标,另一个用于Facebook.
有没有办法从应用程序中的代码中获取此图标?
最后,我解决了它:
private Drawable getIconForAccount(Account account, AccountManager manager) {
AuthenticatorDescription[] descriptions = manager.getAuthenticatorTypes();
PackageManager pm = getContext().getPackageManager();
for (AuthenticatorDescription description: descriptions) {
if (description.type.equals(account.type)) {
return pm.getDrawable(description.packageName, description.iconId, null);
}
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1639 次 |
| 最近记录: |