igorvd
05/17/2018, 2:45 PMandroid architecture components with LiveData, is still necessary to cancel my coroutines in the onDestroy lifecycle method ?540grunkspin
05/17/2018, 2:52 PM540grunkspin
05/17/2018, 2:53 PMlouiscad
05/17/2018, 3:31 PMigorvd
05/17/2018, 4:41 PMonDestroy may be called on configuration changes, and so, if I cancel a coroutine that was used to start an async operation, I kinda miss the lifecycle aware part of the LiveData, because it will restart my work
- The part of memory leaks I understand and yeah, it's always something relevant. But I guess it's not possible because I use the livedata to update the UI.
I asked because I'm not sure if I'm missing something here. Thanks guys!louiscad
05/18/2018, 7:13 AMViewModel, and cancel your parent job in its onCleared methodigorvd
05/18/2018, 1:15 PMlouiscad
05/18/2018, 1:17 PMigorvd
05/18/2018, 1:35 PMlaunch(UI, parent = Job) { viewModel.doSomething() } , on the ViewModel I just use async or withContext. The async I can associate with a parent job too, but the withContext I can't. Do you have an opnion about that?louiscad
05/18/2018, 1:42 PMigorvd
05/18/2018, 4:30 PMlaunch(UI) on the viewModel?louiscad
05/19/2018, 11:46 PMlouiscad
05/19/2018, 11:47 PMactor in your ViewModeligorvd
05/21/2018, 12:08 PMlouiscad
05/21/2018, 1:57 PM