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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With