Issue
I faced with a really strange problem. This occurs only if I set a drawable as src to ImageView.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.backgrounds.test/com.backgrounds.test.activities.PointsActivity}: android.view.InflateException: Binary XML file line #76: Binary XML file line #76: Error inflating class ImageView
Caused by: android.view.InflateException: Binary XML file line #76: Binary XML file line #76: Error inflating class ImageView
Caused by: android.view.InflateException: Binary XML file line #76: Error inflating class ImageView
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.at.d()' on a null object reference
at android.support.v7.widget.au.setImageDrawable(Unknown Source:5)
This error is not occurring if I don't set any drawable to this ImageView.
I tried to change drawables, compress them, re-import to project but nothing helped me. Can someone help me?
Solution
I have also facing same problem, and solving by addding below line in your Activity's onCreate() method:
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
and also try with adding in ImageView of your xml file:
app:srcCompact instead of android:src.
Its work for me.Please try it helps you.
Answered By - Janvi Vyas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.