What i am trying to do is to convert the ArrayList<Model>
to MutableLiveData<ArrayList<Model>>
to be send as a return value. Though i am getting the ArrayList<Model>
result correctly,i failed miserably in posting the value to MutableLiveData<ArrayList<Model>>
.
This is what i am trying to do...
suspend fun getSeasonBodyWeight(): MutableLiveData<ArrayList<MSBodyWeight>> {
val x = MutableLiveData<ArrayList<MSBodyWeight>>()
val y:ArrayList<MSBodyWeight> = getBWeightCoroutine()
x.postValue(y)
Log.i(TAG, "Check ${y.size}")
Log.i(TAG, "Check ${x.value}")
return x
}
This is what i getting in Logcat
I/FirebaseConnect: Check 2
I/FirebaseConnect: Check null
So what am i doing wrong. Also how to convert ArrayList<Model>
to MutableLiveData<ArrayList<Model>>
I am trying to learn Kotlin.. Please bear with me if its a NOOB question.
Thanks