Skip to content Skip to sidebar Skip to footer

Resources$notfoundexception: Drawable Com.example.test:drawable/back_button With Resource Id #0x7f080073

I recently added vector drawables (anydpi) to my android studio project in addition to png images (mdpi, hdpi, xhdpi, and xxhdpi)--android studio does this by default now. I immedi

Solution 1:

There is no problem with your code, we need to add the @drawable/back in every drawable folder example "main/res/drawable-xxhdpi", "main/res/drawable-xhdpi” …etc then only it will work. (i.e every size ex: hdpi, mdpi,xxhdpi..etc)

we can add the back.png in every folder using android studio by following steps

  1. click “File” and then Click on "New", then "Image Asset"

options

  1. Change "Asset Type" to "Action Bar and Tab Icons”

Action bar and tab icons

  1. For "Foreground" choose “ClipArt"

clipart

  1. For "Clipart" click and "Choose" button and pick any icon

choose clipart

  1. For "Resource Name" type in your icon file name name

6. Click Next then all sizes of the images(hdpi, mdpi,xxhdpi..etc) will be generated

Solution 2:

Drawableicon= AppCompatResources.getDrawable(context, R.drawable. back_button);
actionBar.setHomeAsUpIndicator(icon); 

and set below to on create

AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); 

Post a Comment for "Resources$notfoundexception: Drawable Com.example.test:drawable/back_button With Resource Id #0x7f080073"