如何获得特定帐户AccountManager.getAccounts相关的图标() [英] How to get an icon associated with specific Account from AccountManager.getAccounts()
本文介绍了如何获得特定帐户AccountManager.getAccounts相关的图标()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个每个账户显示在账户设置一个图标。对于谷歌帐户有一个图标,对于Facebook的另一回事。
There is an icon displayed in account settings for each account. For Google account there is one icon, for Facebook another.
有没有让应用程序从code该图标的方式?
Is there a way of getting this icon from code in application?
推荐答案
最后,我解决了这个问题:
Finally, I solved it:
private Drawable getIconForAccount(Account account, AccountManager manager) {
AuthenticatorDescription[] descriptions = manager.getAuthenticatorTypes();
for (AuthenticatorDescription description: descriptions) {
if (description.type.equals(account.type)) {
PackageManager pm = getContext().getPackageManager();
return pm.getDrawable(description.packageName, description.iconId, null);
}
}
return null;
}
这篇关于如何获得特定帐户AccountManager.getAccounts相关的图标()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文