There is an icon displayed in account settings for each account. For Google account there is one icon, for Facebook another.
Is there a way of getting this icon from the code in application?
Finally, I solved it:
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With