Skittles Skittles - 1 month ago 23
Android Question

Viewing an Android database cursor

Would anyone know how I can view what a cursor has in it during debugging so that I can determine the functionality of my database helper?

It keeps acting like it's returning data, but then when I attempt to use the cursor.isNull(0) method, I keep getting nullPointerExceptions thrown and not being able to see what the cursor has in it while stepping through the execution is really frustrating me.

Any help would be extremely appreciated.

Thanks.

Answer

If that's null pointer exception, it seems your cursor really is null.

I would use Log.d() to help debug my cursors, you can simply create a helper method to dump the whole row of your cursor to LogCat.