android.content.res.Resources$NotFoundException: Resource ID #0x7f07006e

后端 未结 3 690
轻奢々
轻奢々 2020-11-29 10:15

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

相关标签:
3条回答
  • 2020-11-29 10:31

    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.

    0 讨论(0)
  • 2020-11-29 10:33

    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.

    0 讨论(0)
  • 2020-11-29 10:51

    maybe you have a resource in drawable-v24 . just move them to drawable.

    0 讨论(0)
提交回复
热议问题