Skip to content

Resources$NotFoundException #2

Description

@nightwolf738

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions