How can I perform LiveData transformations on a background thread?
问题 I have a need to transform one type of data, returned by a LiveData object, into another form on a background thread to prevent UI lag. In my specific case, I have: MyDBRow objects (POJOs consisting of primitive long s and String s); a Room DAO instance emitting these via a LiveData<List<MyDBRow>> ; and a UI expecting richer MyRichObject objects (POJOs with the primitives inflated into e.g. date/time objects) so I need to transform my LiveData<List<MyDBRow>> into a LiveData<List<MyRichObject>