Hello ! If I create a fragment programmatically, s...
# android
c
Hello ! If I create a fragment programmatically, should I add Observers on a view for some LiveData (in a ViewModel) in the
onCreateView
function, or somewhere else?
d
I'm initializing and observing everything inside
onActivityCreated
because it is called when the fragment's view hierarchy instantiated
c
Okay ! Thanks you very much 🙂
🙌 2
s
Article was updated few months ago and recommendation is to use getViewLifecycleOwner() in onCreateView()
👍 2
c
@Sam Thanks for that article! I'll be sure to read it !