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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -