title: Android: How to close a cursor that returns from Class to Activity
body: <p>I have: Accounts.java</p>
  
  <pre><code>public class Accounts{
  
      private SQLiteDatabase dbConfig;
  
  public Cursor list(Context context, String db, String where, String order) {
  
      DBHelper dbHelper = new DBHelper(context, db);
      dbConfig = dbHelper.getReadableDatabase();
  
      Cursor c = dbConfig.query("accounts", new String[]{ "iId","sName"}, where, null, null, null, order);
      return c;   
      }
  }
  </code></pre>
  
  <p>and: MainActivity.java</p>
  
  <pre><code>Accounts account = new Accounts();
  Cursor cursor =  account.list(getApplicationContext(), globalDB, null, null);
  while (cursor.moveToNext()) { 
       int id = cursor.getInt(0);
       String name = cursor.getString(1);
  }
  cursor.close();
  </code></pre>
  
  <p>Running my application I get some logcat messages like:</p>
  
  <pre><code>close() was never explicitly called on database...
  </code></pre>
  
  <p>What is the best way to prevent it? How can I close a Cursor that returns from other class?
  Thanks</p>