Skip to content Skip to sidebar Skip to footer

Mvvm Recyclerview Livedata Room Searchview

I am making database app using room, mvvm, livedata . I have Prepopulated it with some data. Now i have two options either i am going to show that prepoulated data when app turns o

Solution 1:

Please change your @Dao class like this

@Dao
abstract class SearchDao : BaseDao<SearchPojo> {

    @Query("Select * from SearchPojo")
    abstract fun allSearch(): LiveData<List<SearchPojo>>

    @Query("Select * from SearchPojo where userName GLOB '*' || :userNameSearch|| '*'")
    abstract fun searchViaID(userNameSearch: String) : LiveData<List<SearchPojo>>

    @Insert
    abstract override fun insert(searchPojo: SearchPojo)

}

Post a Comment for "Mvvm Recyclerview Livedata Room Searchview"