get image from raw resource folder

I am creating a custom country code picker everything is working great except that i am unable to attach countries flags in the list. i have all flags is raw resource folder.
I tried something like this

Uri uri = Uri.parse("android.resource://"+getPackageName()+"/raw/"+code);

where code is a keyword. Then in ma list adapter


But imageview is not visible

here is how i am creating the list

JSONArray countriesArray = new JSONArray(jsonString);
        for ( int i = 0; i < countriesArray.length(); i++)
            JSONObject object = (JSONObject) countriesArray.get(i);
            String name = object.getString("name");
            String dial_code = object.getString("dial_code");
            String code = object.getString("code");
            Uri uri = Uri.parse("android.resource://"+getPackageName()+"/raw/"+code);

            CountryCode country = new CountryCode(name,dial_code,code,uri);

I don’t want to use any library, please don’t suggest that