'How to add query to room database and retrieve to recylerview
I have event database and adapter. I want to show event based on selected date. How can I solve it?
private fun setEventAdpater(date:String) {
val linearLayoutManager=LinearLayoutManager(this,RecyclerView.VERTICAL,false)
eventRecyclerView?.layoutManager=linearLayoutManager
eventModel.allEvents.observe(this, Observer {
events->
eventRecyclerView?.adapter =RecyclerViewAdapter(events)
Log.d("events",events.toString())
})
}
Database Query
@Query("SELECT *FROM events")
fun getAllEvents(): LiveData<List<Event>>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
