I have a question about Coroutines on Android. A b...
# coroutines
r
I have a question about Coroutines on Android. A button in an Activity open a BottomSheetFragment that implement a CoroutineScope, I cancel the parent job on Fragment destroy. A button in the BottomSheet start a Coroutines and do a long running task. Of course if I close this fragment the job is cancelled. But if I implement CoroutineScope in the Activity and cancel the parent job on Activity destroy, can I pass the Coroutines scope/context to the Fragment so that if I start a Coroutine in the BottomSheet and close it the Coroutine is not cancelled?
t
coroutineContext can have only 1 job. structured concurrency is defined as job's parent/childlen relation. then you can make job on the fragment to child of activity's job.
👍 1