Glide: Kotlin into(Target) Can not build. [into(Y) into(ImageView!)]

Created on 14 Dec 2017  路  2Comments  路  Source: bumptech/glide

Kotlin

Glide Version:
4.4.0


Device/Android Version:
minSdkVersion 21


Issue details / Repro steps / Use case background:

        var target = object : SimpleTarget<ByteArray>(800, 800) {
            override fun onResourceReady(resource: ByteArray?, transition: Transition<in ByteArray>?) {

            }
        }

        Glide.with(this).load(mFile).into(target)

Can not build project, because 'into()' has error.
Java known target is what, Kolin didn't known.

Error:(221, 46) None of the following functions can be called with the arguments supplied:
public open fun <Y : Target<Drawable!>!> into(@NonNull p0: ???): (???..???) defined in com.bumptech.glide.RequestBuilder
public open fun into(p0: ImageView!): ViewTarget<ImageView!, Drawable!>! defined in com.bumptech.glide.RequestBuilder
question stale

Most helpful comment

Glide.with(this).load(mFile) returns a RequestBuilder<Drawable>. In turn, RequestBuilder<Drawable> requires a Target<Drawable>, but you're providing a Target<ByteArray>.

Either use Glide.with(this).as(ByteArray.class) or provide a Target<Drawable>. I'm not totally sure what ByteArray is, but if it's equivalent to the Java byte[] then it should work.

All 2 comments

Glide.with(this).load(mFile) returns a RequestBuilder<Drawable>. In turn, RequestBuilder<Drawable> requires a Target<Drawable>, but you're providing a Target<ByteArray>.

Either use Glide.with(this).as(ByteArray.class) or provide a Target<Drawable>. I'm not totally sure what ByteArray is, but if it's equivalent to the Java byte[] then it should work.

This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tryking picture Tryking  路  3Comments

sergeyfitis picture sergeyfitis  路  3Comments

piedpiperlol picture piedpiperlol  路  3Comments

r4m1n picture r4m1n  路  3Comments

Morteza-Rastgoo picture Morteza-Rastgoo  路  3Comments