Use a Cursor field in another method

Posted by Mats Hofman on Stack Overflow See other posts from Stack Overflow or by Mats Hofman
Published on 2010-06-07T17:31:09Z Indexed on 2010/06/07 17:32 UTC
Read the original article Hit count: 631

Filed under:

Hi,

In my app i have have a Cursor field and in the onStart() method of my Android Service I create it by fetching records from my database. When i look into my cursor in the onStart() method i find a number of records but when i try to use them in my trigger() method it has zero records.

the field private Cursor c;

in onStart() c = dbHelper.fetchAllRecords();

in trigger() c.getCount() returns null

I didn't close the cursor earlier than in my onDestroy() method

© Stack Overflow or respective owner

Related posts about android