https://kotlinlang.org logo
#android
Title
# android
n

Niebin

05/28/2018, 8:28 AM
have someone know it ?
d

droid

05/29/2018, 2:45 PM
Hey @Niebin, a little late for the reply. I had something similar situation. I initialized the adapter without data in onActivityCreated() . I have a transformation in the ViewModel which the fragment observes inside onViewModelCreated(). The transformation helps me observe the dataset live data, when I receive the update, I update the adapter with new dataset.
I am not exactly sure if this is your use case, but it seems like you can do something similar.
n

Niebin

05/30/2018, 2:23 AM
Thanks man!I have already solved it,but because there is some error in the child fragment!It did not print the error message directly but print "already added" message .If in the java,it will be printing error directly at the location of what the error occured. So I am so confused with the way of the Kotlinlang.
d

droid

05/30/2018, 2:07 PM
I see.
2 Views