Suppose that I have a Vector Drawable XML file hosted somewhere on the web. I want to display that image resource in my app using either Glide or Picasso, would that be possible?
I've seen this question and it seems to be possible to do it "manually". I also know that it's possible to load rasterized images. But I wonder if there's a way to do it like:
Glide.with(activity)
.load(vectorDrawableUrl)
.into(imageView)
Or even:
Picasso.get()
.load(vectorDrawableUrl)
.into(imageView)
From my initial tests, it didn't work. Glide started to pop some random errors, like:
W/Glide: Load failed for https://path.to.url/ic_key.xml with size [420x420]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There were 8 causes:
java.io.IOException(java.lang.RuntimeException: setDataSourceCallback failed: status = 0x80000000)
java.io.IOException(java.lang.RuntimeException: setDataSourceCallback failed: status = 0x80000000)
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
java.io.IOException(java.lang.RuntimeException: setDataSourceCallback failed: status = 0x80000000)
java.io.IOException(java.lang.RuntimeException: setDataSourceCallback failed: status = 0x80000000)
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000)
And with Picasso I got:
D/skia: --- Failed to create image decoder with message 'unimplemented'
D/skia: --- Failed to create image decoder with message 'unimplemented'
D/skia: --- Failed to create image decoder with message 'unimplemented'
Am I missing something?
It seems that those vector drawables are transformed with AAPT, and that might make things more difficult (or even impossible). Perhaps that's why I was unable to load the files directly.
User contributions licensed under CC BY-SA 3.0