Using LiveData Transformations
Now that CrimeFragment has the crime ID, it needs to pull the crime object from the database so it can display the crime’s data. Since this requires a database lookup that you do not want to repeat unnecessarily on rotation, add a CrimeDetailViewModel to manage the database query.
When CrimeFragment requests to load a crime with a given ID, its CrimeDetailViewModel should kick off a getCrime(UUID) database request. When the request completes, CrimeDetailViewModel should notify CrimeFragment and pass along the crime object that resulted from the query.
Create a new class named CrimeDetailViewModel and expose a LiveData property to store and publish the Crime pulled from the database. Use LiveData to implement ...