Vectordrawable To Bitmap: Bitmap.sethasalpha(boolean)' On A Null Object Reference
I'm trying to get Bitmap from VectorDrawable (xml image): VectorDrawable vectorDrawable = (VectorDrawable) ContextCompat.getDrawable(mContext, R.drawable.test); Bitmap bitmap = Ut
Solution 1:
You are trying to allocate a 16000x16000dp Bitmap that, based on the density of the display you're running your app, must be multiplied by a factor of 2 for xhdpi, 3 for xxhdpi and 4 for xxxhdpi. This causes memory problems since you are trying to allocate a Bitmap that is larger than 1000MB.
You need to scale down your Drawable. It shouldn't cause the quality loss you're experiencing so I suggest you to check your SVG or the output of svg2android for errors...
Also remember that you can't put Bitmap larger or higher than GL_MAX_TEXTURE_SIZE into ImageView. See: "Bitmap too large to be uploaded into a texture"
Solution 2:
change
android:width="16000dp"android:height="16000dp"
to
android:width="24dp"android:height="24dp"
don't need to chagne:
android:viewportWidth="16000"android:viewportHeight="16000">
Post a Comment for "Vectordrawable To Bitmap: Bitmap.sethasalpha(boolean)' On A Null Object Reference"