Description
I have TabLayout with multiple fragments. I want to save fragment data into Room DB on fragment change/swipe and display data to the user when it back to fragment.
Currently Using
Currently, I am using coroutine with GlobalScope.launch
to save into a fragment and it is working fine.
Questions
1. What is the best practice to use a coroutine with fragments to save data to DB on fragment change?
2. It is good practice to use GlobalScope.launch
on fragment change?
3. if GlobalScope.launch
is not good to use then what we can use instead of it?