Hello guys! I'm getting the following error when ...
# announcements
n
Hello guys! I'm getting the following error when I'm converting an old JAVA class to kotlin: MutableLiveData<LiveDataRetrofitWrapper<?>> cannot be converted to MutableLiveData<LiveDataRetrofitWrapper> Here's where the error occurs:
MutableLiveData<LiveDataRetrofitWrapper> reminders = mRepository.getImportantRemindersByTimestamp(token, timestamp);
And the getImportantRemindersByTimestamp returns this:
val data = MutableLiveData<LiveDataRetrofitWrapper<*>>()
return data
I can understand the error, but I have no idea how to fix it. Thanks!
p
Make type of variable
reminders
to be the same as type returned by a function, i.e
MutableLiveData<LiveDataRetrofitWrapper<*>>
Wait, is
reminders
variable declared in Java and method is in Kotlin?
n
Its declared in a JAVA class.
t
In the first code snippet LiveDataRetrofitWrapper does not seem to be a generic data type. At least it has no type parameter.
n
As a last effort I ended up converting and the other class to kotlin and now they behave nice. Thanks!
👍 1