flagkit
flagkit copied to clipboard
Resources$NotFoundException
I'm getting android.content.res.Resources$NotFoundException: Resource ID #0x0
error for this:
FlagKit.drawableWithFlag(getContext(), "TR")
Since passing capital letters causes this exception. I solve the issue by passing tr
But it would be better if you solve this in SDK like this:
public static Drawable drawableWithFlag(Context context, String flagName) {
Resources res = context.getResources();
int resourceId = res.getIdentifier(flagName.toLowerCase(), "drawable", context.getPackageName());
return res.getDrawable(resourceId);
}
converting the iso to small letters, worked for me.