Ardi
Ardi

Reputation: 1871

Kotlin extension not recognized in adapter

I have basic extension util for picasso:

public val Context.picasso: Picasso 
get() = Picasso.with(this)

public fun ImageView.load(path: String, request: (RequestCreator) -> RequestCreator) {
    request(context.picasso.load(path)).into(this)
}

And when I try to call it from imageview context in adapter it's not recognized.

enter image description here

Same thing with itemView.context.picasso

Thanks!

Upvotes: 2

Views: 1638

Answers (1)

Egor Neliuba
Egor Neliuba

Reputation: 15054

I'm pretty sure your extensions are out of scope (in a different package). Import your extensions like so:

import your.package.picasso
import your.package.load

Take a look at the docs for more info.

Upvotes: 1

Related Questions