Sometimes for some drawables in my project i i got an exception: Exception: ex:android.content.res.Resources$NotFoundException: Drawable com.my.app:drawable/draghandlerounded with resource ID #0x7f0801b5
I have a list of drawables in my project (2000). I receive the name of the drawable then, convert get drawable id:
val iconDrawableId = resourceProvider.getAppContext().resources.getIdentifier(iconName, "drawable", resourceProvider.getAppContext().packageName
i get drawable with the ContextCompat
class
ContextCompat.getDrawable(resourceProvider.getAppContext(), iconDrawableId)
draghandlerounded.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32px"
android:height="32px"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M19,9H5c-0.55,0 -1,0.45 -1,1s0.45,1 1,1h14c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1zM5,15h14c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1H5c-0.55,0 -1,0.45 -1,1s0.45,1 1,1z"
android:fillColor="#000000"
android:fillAlpha="0.87"/>
</vector>
I tried to get drawable with theme, but it does not help.