How To Test If Cursor Is Empty in a SQLiteDatabase Query

What about testing the cursor like this, and then doing what you’ve said:

if(cursor!=null && cursor.getCount()>0)

getCount ()

Returns the numbers of rows in the cursor

http://developer.android.com/reference/android/database/Cursor.html#getCount()

Leave a Comment