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
- click “File” and then Click on "New", then "Image Asset"
- Change "Asset Type" to "Action Bar and Tab Icons”
- For "Foreground" choose “ClipArt"
- For "Clipart" click and "Choose" button and pick any icon
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"