• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

room database problem

frappydan

Lurker
I've been using sqlite forever. Finally decided to update my app to room database. Converting it was a treat but afterwards I realized I may have lost a functionality that the DBHelper allowed me to do.

I am currently getting LiveData<List<type>> return from the Dao of my main table. Getting that through a Repository and a ViewModel which holds the LiveData along with an observer. In the database helper I had a routine after iterating the cursor that created a List<object>. The regular rows + header objects mixed in with them. i could then check for type in the Recyclerview adapter and either create a header or a row.

In the Dao I have several @Query lines but not sure how to use the Query to return the same result. I could get the List<type> from the viewmodel observer and work a little mojo on it finally passing it into an object list and use that for the Recyclerview adapter. The livedata would keep the feed up to date. Is there a better way?
 
Back
Top Bottom