With the ability to retrieve data from your database, it seems appropriate that we display those records for the user to see in a fragment. At this stage, you may be wondering: how do we effectively return this list of movies from the view model to the fragment? Or maybe you are thinking: what should happen if I make a call to the database and, at the same time, the user decides to leave my app to do something else? Should we return the data nonetheless and waste resources or should we not. Luckily, there’s a Google’s Android library we can use that will handle all those awkward edge cases for us. Hello, LiveData.
In this tutorial, we will look into LiveData, what exactly it is, and how it fits into our application.
from DZone.com Feed http://bit.ly/2Jhwswj
No comments:
Post a Comment