I am trying to write a ContentProvider which itself is based on a
SqlLite database. I am puzzled when I need to close the database
because ContentProvider has onCreate( ) function but not onDestroy( )
function.

I downloaded the android source code tree, and found
com.example.codelab.rssexample.RssContentProvider

It appears this class called "openDatabase" but never "close" on it:

=========
    @Override
    public boolean onCreate() {
        ...
        final Context con = getContext();
        try{
            mDb = mDbHelper.openDatabase(getContext(), DATABASE_NAME,
null, DB_V
ERSION);
        ...
     }

=========
mDb.close( ) is never called
=========

If there is no onDestroy() from ContentProvider and we don't call close
( ) on databases, doesn't this lead to some kind of memory/resource
leak?

Wah
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to