tags:

views:

66

answers:

1

Hi,

I want to know when a close method of a sqlite database should be called in a life cycle, since the NotePad sample in the sdk (http://developer.android.com/resources/tutorials/notepad/index.html) doesn't call NotesDbAdapter.close(), it implements that method though.

My application accesses the db not so frequently, but some, it depends on user requests. I think I should open the db at the onCreate, and close it at the onDestroy. Is that a good practice?

Thanks in advance, yokyo

A: 

I think I should open the db at the onCreate, and close it at the onDestroy. Is that a good practice?

Yes, that is a fine pattern to use.

CommonsWare
Thanks CommonsWare. You assured me ;)
Yoo Matsuo