'how to implement UI changes when resuming fragment in kotlin

i'm a beginner developing in kotlin * android studio. i have 2 fragments in my app: a main fragment and a settings fragment. the two share a viewmodel. heres what i'm trying to accomplish:

  1. app launches, takes you to main fragment
  2. user clicks settings button, takes you to settings fragment
  3. user alters settings (preferences stored in shared viewmodel)
  4. user returns to main fragment, UI of main fragment is altered based on which settings were selected

i have completed steps 1-3 and am trying to implement 4. i am thinking i should override onResume() in my main fragment and implement UI changes there. first off, is this a good idea? if so, how can i access my UI elements from onResume()? any guidance is appreciated



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source