Skip to content
Advertisement

Reading and displaying values from SQLite and storing them inside a List

I am trying to read and display all the data from my db but I get the following error. Also the recyclerview is not displaying any data.

How I read from the DB.

How I add the elements into the db.

How I try to display the data saved in a list.

Class where I save all my data.

ERROR: [![error][1]][1] [1]: https://i.stack.imgur.com/eyHoY.png

Advertisement

Answer

You should start from 0 and count up. I can see that you start from 1 and that’s where it is wrong.

Try replacing getString(1) with getString(0).

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement