I tried to handle image not found (404) error in Glide, but it doesn't compile :
Glide.with(this@ImageActivity)
.addDefaultRequestListener(
object:RequestListener<Drawable> {
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
)
.load(imageURL).apply(requestOptions)
.into(imageview)
But compiler raises this error on object:RequestListener :
Type mismatch: inferred type is but RequestListener! was expected