So i want to have pictures show on my view from the Unsplash API. The thing is the API call is working but the pictures just don't show. All it is showing is the error placeholder.
Here is the Binding Adapter
@BindingAdapter("pictureOfDay")
fun CustomImage.displayPicture(carouselItem: CarouselItem?) {
if (carouselItem?.urls == "images")
Glide.with(context).load(carouselItem.urls)
.error(R.drawable.glowing_x)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(this)
else setImageResource(R.drawable.glowing_x)
}
Any ideas are welcome, thank you.
So I ended up solving it. I had to change up my binding adapter, so that it accepted a string. Something like this...
@BindingAdapter("pictureOfDay")
fun CustomImage.setDisplayPicture(urlPic: String?) {
if (urlPic != null)
Glide.with(context).load(urlPic)
.error(R.drawable.glowing_x)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(this)
else setImageResource(R.drawable.glowing_x)
}
Works perfectly fine now.