title: which is right place to open/close database resources in list fragment with Async Task loader
body: <p>Which is the best place to open and close Database resources in ListFragment which implements LoaderManager.LoaderCallbacks?</p>
  
  <p>I have a list fragment which implements <code>LoaderManager.LoaderCallbacks&lt;Cursor&gt;</code>. Now I init loader in <code>onActivityCreated</code> and in <code>onCreateLoader</code> returned a Loader(MyLoader). The MyLoader class open database resources.then Cursor object returned to  <code>onLoadFinished</code>. Here where can i close my opened databse,because we cannot close database before cursor returnted to onLoadFinished.</p>
  
  <p>Many persons said, open database resources in Activity onResume and close in onPause is best.But if i use AsynctaskLoaders how to close the database resources?</p>
  
  <p>I got following error,</p>
  
  <pre><code>close() was never explicitly called on database 'mydb' 
  android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
  at android.database.sqlite.SQLiteDatabase.&lt;init&gt;(SQLiteDatabase.java:1849)
  </code></pre>