private SimpleTarget target = new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap bitmap, GlideAnimation glideAnimation) {
// do something with the bitmap
// for demonstration purposes, let's just set it to an ImageView
imageView1.setImageBitmap( bitmap );
}
};
private void loadImageSimpleTarget() {
Glide.with(context)
.load(uri)
.override(600, 600)
.fitCenter()
.into(target);
}
I tried to convert it into Kotlin like as follow.
val finish_target = object : SimpleTarget<Bitmap>() {
override fun onResourceReady(bitmap: Bitmap?, glideAnimation: GlideAnimation<in Bitmap>?) {
preview_image.setImageBitmap(bitmap)
}
}
Glide.with(context)
.load(uri)
.override(600, 600)
.fitCenter()
.into(finish_target)
But compilation error shows that
public open fun <Y : Target<GlideDrawable!>!> into(target: (???..???)): (???..???) defined in com.bumptech.glide.DrawableRequestBuilder
public open fun into(view: ImageView!): Target<GlideDrawable!>! defined in com.bumptech.glide.DrawableRequestBuilder
Please kindly help me how to solve this problem.