ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 10 - Associate Android Developer discussion

Report
Export

In our TeaViewModel class, that extends ViewModel, we have such prorerty: val tea: LiveData<Tea>

An observer in our Activity (type of mViewModel variable in example is TeaViewModel) is set in this way:

mViewModel!!.tea.observe(this, Observer { tea: Tea? -> displayTea(tea) })

What will be a correct displayTea method definition?

A.
private fun displayTea()
Answers
A.
private fun displayTea()
B.
private fun displayTea(tea: Tea?)
Answers
B.
private fun displayTea(tea: Tea?)
C.
private fun displayTea(tea: LiveData?<Tea>)
Answers
C.
private fun displayTea(tea: LiveData?<Tea>)
D.
private fun displayTea(tea: LiveData?<T>)
Answers
D.
private fun displayTea(tea: LiveData?<T>)
Suggested answer: B
asked 18/09/2024
Jacobo Montes
28 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first