Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

Why must a Fragment use viewLifecycleOwner when observing LiveData?

  1. A The Fragment's view is destroyed and recreated on the back stack while the Fragment itself survives
  2. B LiveData requires it syntactically
  3. C It improves performance
  4. D It enables data binding
Answer

The Fragment's view is destroyed and recreated on the back stack while the Fragment itself survives

Using the Fragment lifecycle instead creates duplicate observers each time the view is recreated, which is a classic bug.

All Android MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as