T
T
Tamerlan Godzhiev2019-04-10 16:06:09
Android
Tamerlan Godzhiev, 2019-04-10 16:06:09

How to display information from database in RecyclerView?

Good day everyone!
Please tell me the algorithm for displaying information from the database in RecyclerView. I can't figure out how to pass cursor data to adapter. I have a created database. One table with columns NAME, NEWPRICE, OLDPRICE.
Please help) I've been driving for three days (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2019-04-10
@zagayevskiy

In general, you can write an adapter right around the cursor, no one forbids this. In total, you need to write three methods - onCreateViewHolder, onBindViewHolder, getItemCount. But this is a vicious path, so there is no point in describing it.
And so - you need to download the data from the cursor to the list of models, and write an adapter for it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question