Home > database >  Kotlin android development diffutil itemCallback type error
Kotlin android development diffutil itemCallback type error

Time:11-17

Im trying to implement diffutil in my adapter and im getting the following error:

One type argument expected for class Result<out T>

This is the code where i get the error:

private val diffCallback = object: DiffUtil.ItemCallback<Result>() {

}

This is my Result class:

data class Result(
    val adult: Boolean,
    val backdrop_path: String,
    val genre_ids: List<Int>,
    val id: Int,
    val media_type: String,
    val original_language: String,
    val original_title: String,
    val overview: String,
    val popularity: Double,
    val poster_path: String,
    val release_date: String,
    val title: String,
    val video: Boolean,
    val vote_average: Double,
    val vote_count: Int
)

I don't understand,this is exactly how i do this every time,and it works without problems

CodePudding user response:

Kotlin already has a Result<T> type, and it's imported by default. You might need to fully qualify your own class name if you want to make sure you're using that one. Or maybe just rename your class, it will make things easier.

  • Related