kendhia
kendhia

Reputation: 299

Not sure how to convert cursor to this method return type

I'm asking this question again 'cuz the provided answers are not compatible with the new version of Android Paging Library. My Dao function is as following

@Query("SELECT * FROM items")
fun getAll() : DataSource.Factory<Int, List<Item>>

There's not a something different from the samples provided by google-developers but i keep getting the following error :

error: Not sure how to convert a Cursor to this method's return type
                                                                                                                              ^
FAILURE: Build failed with an exception.

any ideas of the reason of this error ?

Upvotes: 2

Views: 1970

Answers (1)

kendhia
kendhia

Reputation: 299

I found the solution and the explanation is that DataSource.Factory will already return a PaginedList of the items, so there's no need of calling it with a List<Item>.

Upvotes: 1

Related Questions