android - Is it dangerous not closing Cursor in getCursor method? -
i've made own getcursor
method looks this
protected cursor getcursor(string selectquery) { sqlitedatabase db = this.getwritabledatabase(); cursor cursor = db.rawquery(selectquery, null); return cursor; }
since cannot call cursor.close()
before return it, dangerous leaving cursor open this? or close method returns object?
you @ some point "toomanycursorsexception" - or something that. you're using cursor have try {} finally{} block , in say:
if(cursor != null) { cursor.close(); }
i used web programming create model pojos when reading data dao , use in up-levels. never sending cursor above layers.
Comments
Post a Comment