Learning Android Development
Cautious: LiveData Transformation Functions are Performed in MainThread
It is documented, but might not be noticed if we’re not careful
Published in
4 min readDec 29, 2021
First of all, credit to Jossi Wolf for his excellent article below. Because of the article, it enlighten me on this info.
It took me a while to digest the content, hence I’m writing the summary gist of it, for my easier reference in the future, with a very simple design as an example.
Pre-requisite — Understand what LiveData is
Put it simply, LiveData is an intermediary communication between the View (Activity/Fragment) and its ViewModel.
The benefit of LiveData are,
- It is aware of the View’s lifecycle. It only gets the data through when the View is active