Actually, I have no idea why I have this error.
Follows the code hoping that there is everything useful for a diagnosis.
The structure of the app is a standa
It looks like your issue is with this line:
holder.countryPhoto.setImageResource(itemList.get(position).getPhoto());
itemList.get(position).getPhoto()
must return a valid ResId. (Refer to the ImageView documentation.
As you mention, itemList
looks to be set up correctly. I suggest that you set a breakpoint at the above line and see what is being returned from getPhoto()
. You should also be able to determine if this is the line causing your exception.
If that doesn't help, post ItemObject
here so we can get a look at getPhoto()
and maybe a couple of other things.
I just noticed the V24 by the drawables in the image you posted. I agree with Dennis K's comment that your phone is API23 and you have drawables for API 24+. Android will not select these drawables if the API level is less than API 24. If these drawables are suitable for API 23, move them to a folder that supports API 23.
See Providing Resources.
Platform Version (API level) Examples: v3 v4 v7 etc.
The API level supported by the device. For example, v1 for API level 1 (devices with Android 1.0 or higher) and v4 for API level 4 (devices with Android 1.6 or higher). See the Android API levels document for more information about these values.
Your problem is the wrong placement of resources(images). You use (API 23) but resources for API 23 is null, because they only API 24 and up.
Now all images marked (v24) this means that they are in drawables-v24 just move in drawable
that'll solve your problem.
maybe you have a resource in drawable-v24 . just move them to drawable.