I'm making an Android application and part of the application calls a Google API for photos for specific locations. These photos will be part of a list and I want to make it so once I call the API and download the photo, I can save it locally and resuse that later rather than recall the API. My code is pasted below
fun placePhotoCall(ref : String, view : ImageView, index : Int) {
if(places[index].image == null) {
Glide.with(this).load(createPhotosRequestURL(ref)).into(view)
places[index].image = view.image
}
else {
view.setImageDrawable(places[index].image)
}
}
This function calls the API, downloads the photo, and stores it in the ImageView. I want to take the drawable image out of said ImageView and store it in an object I created however no matter what I try the image property remains null.
Thanks in advance.