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.
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.