G
G
genbachae2019-12-07 10:15:04
Android
genbachae, 2019-12-07 10:15:04

Kotlin how to work with LiveData correctly?

Dear members of the forum, please tell me why the "onChanged" function is not called?
5dec56122c91f486349510.png
5dec561a6e441479042830.png
I seem to have done the subscription correctly, I update the data by calling: DataController.refresh()
The source code is here: https://github.com/genbachae/T_LiveData

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zakkav, 2019-12-12
@zakkav

You have mixed java and kotlin, try this

liveData?.observe(this, Observer<String> {
    textView.text = it
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question