View Android Database Cursor

Does anyone know how I can see that it has a cursor during debugging so that I can determine the functionality of my database assistant?

It continues to act as if it is returning data, but then, when I try to use the cursor.isNull(0) method, I continue to get a NullPointerException and cannot see that it has a cursor, and the execution of this execution is really disappointing me.

Any help would be greatly appreciated.

Thank.

+45
android debugging cursor
Nov 21 2018-10-11T00:
source share
2 answers

If this is a 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 upload the entire line of your cursor to LogCat.

-6
Nov 21 '10 at 1:48
source share

Android provided a specific class only for debugging cursors. It is called DatabaseUtils .

Call the DatabaseUtils.dumpCursorToString(cursor) method to view the contents of the cursor.

This helper goes through and prints the contents of the cursor for you and returns the cursor to its original position so that it does not spoil your iterative logic.

+260
Oct 28
source share



All Articles