Reputation: 55
The payment platform I am using for my app provides a barcode image in SVG format, as below:
https://api.omise.co/charges/chrg_test_5d90i5vu8tv6vm0q4ah/documents/docu_test_5d90i5wz0qmrc7ogg1j/downloads/FD1649EF22456F4B
How do I take that string/url and display the image in an ImageView? If I paste that string in my browser, it downloads the SVG file.
Do I need to convert the file to/from SVG format into the required format? If so, how would I do that?
Upvotes: 1
Views: 4751
Reputation: 7637
Since ImageView on Android doesn't support SVG natively. You can download the SVG as a string value and load it into a WebView in place of the ImageView.
Upvotes: 1
Reputation: 540
I'd recommend using Glide. This answer should help you more than anything I can write here. You probably don't even need to go to the answer section, the OP includes code for handling an SVG with Glide.
Does Glide have a method for loading both PNG and SVG?
https://github.com/bumptech/glide
Upvotes: 0