34,333
edits
Changes
no edit summary
The repository class will be responsible for interacting with the Room database on behalf of the ViewModel and will need to provide methods that use the DAO to insert, delete and query product records. With the exception of the getAllProducts() DAO method (which returns a LiveData object) these database operations will need to be performed on separate threads from the main thread using the AsyncTask class.
In addition, the AsyncTask to perform a product search will need to return the results to the repository object. This topic was covered in the chapter entitled TBD and begins with the addition of an interface class to the project. Add a new interface class named AsyncResult and modify it so that it reads as follows:
<pre>
== Adding the RecyclerView Adapter ==
<pre>