flagkit icon indicating copy to clipboard operation
flagkit copied to clipboard

Resources$NotFoundException

Open nightwolf738 opened this issue 7 years ago • 1 comments

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);
    }

nightwolf738 avatar May 31 '17 13:05 nightwolf738

converting the iso to small letters, worked for me.

hafs-r avatar Nov 06 '19 10:11 hafs-r