Lesson 8: App architecture (UI layer)

  1. To avoid losing data during a device-configuration change, you should save app data in which class?

  2. A ViewModel should never contain any references to fragments, activities, or views. True or false?

  3. When is a ViewModel destroyed?

  4. What is the ViewModelFactory interface for?

  5. How do you encapsulate the LiveData stored in a ViewModel so that external objects can read data without being able to update it?

  6. LiveData updates a UI controller (such as a fragment) if the UI controller is in which of the following states?

  7. In the LiveData observer pattern, what is the observable item (what is observed)?

  8. In which class should you add the data-formatting logic that uses the Transformations.map() method to convert LiveData to a different value or format?

  9. The Transformations.map() method provides an easy way to perform data manipulations on the LiveData and returns ___.

  10. What are the parameters for the Transformations.map() method?

  11. The lambda function passed into the Transformations.map() method is executed in which thread?