Did you check that there really is data in the cursor before trying to extract anything?
if(c.getCount() > 0){do something}
if you Do not , then you will try to get what is already null, which is BIG NO NO
Also, when you get your items, NOT to get this information: c.getBlob(0)
Other information
The reason for this is that if you decide to change your columns and reorder, it will bite you a lot.
My suggestion is to have static variables that exist in the helper class that reference the column names that you defined like this:
c.getString(c.getColumnIndex(String columnName))
This is much better since you can easily modify the database simply by referencing the name.
Read my post here on how to handle a database and make indirect calls to your database. You will be grateful for all the headaches you avoid.
Check here: Saving lists to a database and extracting them together: Android
Also, when sending a question, the logarithm of the error helps to solve the problem faster.
source share