manlan
08/14/2020, 7:41 PMCasey Brooks
08/14/2020, 7:46 PMcaptureLocation
and capturePhoto
, but doing it within the โscopeโ of the fragment is generally considered bad practice. But using ViewModels as a shared layer between those fragments is perfectly fine. The ViewModel can make those async calls and dispatch the results to the fragments as-neededbrandonmcansh
08/14/2020, 8:18 PMIan Lake
08/14/2020, 9:30 PMIan Lake
08/14/2020, 9:32 PMmanlan
08/15/2020, 7:11 AMcaptureLocation()
and going to a new fragment that handles face capture in capturePhoto()
. I need to somehow wait for these two things to happen and proceed accordingly.manlan
08/15/2020, 7:54 AMIan Lake
08/15/2020, 5:14 PMmanlan
08/16/2020, 4:43 AMmanlan
08/17/2020, 3:18 PMIan Lake
08/17/2020, 3:26 PMmanlan
08/17/2020, 3:27 PMIan Lake
08/17/2020, 4:24 PMnavController.popBackStack()
and can use Navigation's returning a result API, which is stable: https://developer.android.com/guide/navigation/navigation-programmatic#returning_a_resultmanlan
08/17/2020, 4:53 PMmanlan
08/17/2020, 4:53 PMIan Lake
08/17/2020, 6:19 PMobserve
block that is retriggering every time you go back to your other Fragment. LiveData isn't made for eventsmanlan
08/18/2020, 8:00 AMIan Lake
08/18/2020, 1:47 PMIan Lake
08/18/2020, 1:48 PMFlow
is perhaps the cleaner solution - kind of like using the right tool for the jobmanlan
08/18/2020, 5:15 PMFlow
?