I'm getting the following error message
android.content.res.Resources$NotFoundException: If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info.
when im trying to set the following:
view.setBackgroundResource(R.drawable.highlight_background);
or
view.setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.highlight_background));
I also tried using AppCompatImage. This happens on a device with Android 4.4.4. I've found another StackOverflow thread which provides to add
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
into a MyApplication class and
vectorDrawables.useSupportLibrary = true
into the build.gradle. But the error still occurs. The drawable consists of the following:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="2dp" android:color="?attr/colorAccent" />
</shape>
It's just a line to encircle an image. Can anyone help me?
Thanks in advance!