I'm using Glide
to load .png
image asynchronously.
File file = Glide.with(context).load(location).downloadOnly(1024, 1024).get();
In case of .svg
, the file is created but it is not loading into ImageView
.
I'm using Glide
to load .png
image asynchronously.
File file = Glide.with(context).load(location).downloadOnly(1024, 1024).get();
In case of .svg
, the file is created but it is not loading into ImageView
.
ImageView only accepts Bitmaps or VectorDrawables.
SVG is neither of the two, even if VectorDrawable descends from it.
Get a PictureDrawable
from your SVG
file. Then you need to create a Bitmap
from the size of the PictureDrawable
and give it to a Canvas
.
PictureDrawable pictureDrawable = svg.createPictureDrawable();
Bitmap bitmap = Bitmap.createBitmap(pictureDrawable.getIntrinsicWidth(), pictureDrawable.getIntrinsicHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.drawPicture(pictureDrawable.getPicture());
currentBitmap = bitmap;