I Want to load image from json in my assest as a string and then pass it to an imageview. How to do it?
Asked
Active
Viewed 125 times
3 Answers
1
Say your json is something like:
const book = {
id: 1,
title: "my title",
img:"/image/file.png",
...
}
...
you may pass that object directly in your image tag:
eg.
<img src="{book.img}" />

NJAS
- 53
- 5
0
You can use Library like Glide and Picasso for load image in imageview as a string Please check below link How to load Image into ImageView from Url using Glide v4.0.0RC1

Sumit Kumar
- 263
- 1
- 6
0
If you want to store the whole image in your JSON, than you could use base64 to convert from byte[] to String and vice versa. Java has base64 encoders and decoders in it's util packages. Wiki page: https://en.wikipedia.org/wiki/Base64.

AlexAlbu
- 76
- 3