Skip to content

Instantly share code, notes, and snippets.

@GauravChaddha1996
Created January 30, 2021 17:24
Show Gist options
  • Save GauravChaddha1996/d0a82bae4d3076c55e17a8173e74374e to your computer and use it in GitHub Desktop.
Save GauravChaddha1996/d0a82bae4d3076c55e17a8173e74374e to your computer and use it in GitHub Desktop.
class MyFragment: Fragment() {
override fun onViewCreated(view: View, state: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewLifecycleOwner.lifecycleScope.launch {
// do-some ui work
}
}
init {
// some helpful f()s have been
// provided such as launchWhenStarted.
// E.g.We can fragment transaction after onStart etc.
lifecycleScope.launchWhenStarted {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment