Using Ion library to load images from an expansion file

510 views Asked by At

I am using an expansion file to load additional resources and load images. My problem is that I can only use getInputStream and create a drawable from stream. Is that possible with Ion library?

1

There are 1 answers

0
koush On

You can implement your own loader by extending StreamLoader and have it load a expansion file URI of your choosing like expansion://myfile.jpg

See here for an example ContentLoader (which loads content streams).

https://github.com/koush/ion/blob/master/ion/src/com/koushikdutta/ion/loader/ContentLoader.java

And here's how to inject a loader into Ion's pipeline:

https://github.com/koush/ion/blob/master/ion/src/com/koushikdutta/ion/Ion.java#L186