Skip to content
Advertisement

Can’t find the Mistake in my Cursor initialization

And for a bigger APP project I need to work with an SQLite database. If my code works I don’t get any data back. And I think I just don’t understand the cursor object. In this code I simply want to get a firstname back but it sasy that my cursor is not initialized correctly, but I got the basic code from Android developers. So I can’t figure out why it doesn’t work.

JavaScript

I would get back “Jan” as a String but it shows me this Error

JavaScript

Advertisement

Answer

With this:

JavaScript

you define the columns that you want the query to select.
So you want only the column ListeNamen.VORNAME.
But with this:

JavaScript

you try to retrieve the column ListeNamen.NACHNAME which does not exist in the results.
By the name of the variable vorname I guess you want to do:

JavaScript

but since there is only 1 column in the results, you could also do:

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