如何获得特定帐户AccountManager.getAccounts相关的图标()如何获得、图标、帐户、AccountManager

由网友(我在听你要我学的那首情歌)分享简介:这是一个每个账户显示在账户设置一个图标。对于谷歌帐户有一个图标,对于Facebook的另一回事。There is an icon displayed in account settings for each account. For Google account there is one icon, for Face...

这是一个每个账户显示在账户设置一个图标。对于谷歌帐户有一个图标,对于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;
    }
阅读全文

相关推荐

最新文章