Join Slack
Powered by
For a fragment, what's the difference, if any, bet...
# android
k
Ken Maffei
09/02/2020, 4:56 PM
For a fragment, what's the difference, if any, between fragment.lifecycleScope.launch() and fragment.viewLifecycleOwner.lifecycleScope.launch() ?
s
Sebastian Kaspari
09/02/2020, 5:07 PM
The view of a fragment usually has a shorter lifecycle than the fragment. Views can come and go as the fragment gets detached and attached.
Sebastian Kaspari
09/02/2020, 5:08 PM
If you do something inside your launch block that needs the views, than you probably want to bind this to the viewcycle of the views
Open in Slack
Previous
Next