Skip to content Skip to sidebar Skip to footer

'receiver Type Mismatch' With Fragment And Anko Toast

I am trying to use Jetbrains' Anko library to easily display an Android toast message in my app. Here is the relevant code snippet: val message : CharSequence = 'Recycled: ${holder

Solution 1:

Since the error says none are applicable you've probably imported a different Fragment class than the one defined by Android/Support Library.

Check your imports.

Solution 2:

I encountered the same issue using import android.support.v4.app.Fragment.

As Kingsley Adio said in a previous comment, add the following line in the dependencies specified in your module gradle file:

dependencies 
{
...
    implementation "org.jetbrains.anko:anko-support.v4-commons:$your_anko_version"
...
}

Then add this import in your .kt file:

import org.jetbrains.anko.support.v4.toast

Post a Comment for "'receiver Type Mismatch' With Fragment And Anko Toast"