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.taskEditText.text}"
(tasksFragment as Fragment).toast(text = message)
and the error:
Error:(80, 45) Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public inline fun Fragment.toast(text: CharSequence): Unit defined in org.jetbrains.anko
public inline fun Fragment.toast(textResource: Int): Unit defined in org.jetbrains.anko
public fun Context.toast(text: CharSequence): Unit defined in org.jetbrains.anko
public fun Context.toast(textResource: Int): Unit defined in org.jetbrains.anko
public inline fun AnkoContext<*>.toast(text: CharSequence): Unit defined in org.jetbrains.anko
public inline fun AnkoContext<*>.toast(textResource: Int): Unit defined in org.jetbrains.anko
I am pretty new to Kotlin and have been searching for a solution to this issue for a while. All help is appreciated.