vendredi 7 août 2015

Do I have to close the Cursor object whenever I call rawQuery()?

I'm planning to use Android SQLite for the first time.

Cursor c = db.rawQuery("some select command here", null);

// some jobs with the cursor..

c = db.rawQuery("another select command here", null);

// some jobs with the cursor..

c.close();
db.close();

c = null;
db = null;

As you can see, I'm trying to call rawQuery() method several times.

  1. Do I have to close the cursor before I call rawQuery() method AGAIN?

  2. Do I have to assign null to the variable after closing the cursor and database like above?

Aucun commentaire:

Enregistrer un commentaire