How correctly to close the cursor Android Java
<p>If I try to close the cursor with <code>onSets.close();</code> in method <code>getData()</code>, the data does not appear in the position. If I do not close the cursor method, then Eclipse complains and says that the base or the cursor is not closed.
But if I add a line <code>c.moveToFirst();</code> in the method <code>getSets(String toexes_ids, String toprog_dif)</code>, the error does not appear. Why is that? 
 I have two method:</p>

<p>One method in MyDatabase.java</p>

<pre><code>public Cursor getSets(String toexes_ids, String toprog_dif) {
  SQLiteDatabase db = getReadableDatabase();
  SQLiteQueryBuilder qb = new SQLiteQueryBuilder();     
  String [] sqlSelect = {"_id", "exes_ids", "sets_ids", "sets_weight", "sets_ones"}; 
  String sqlTables = "Sets";
  String selection = "exes_ids = " + toexes_ids + " AND " + "prog_dif = " + toprog_dif;
  qb.setTables(sqlTables);
  Cursor c = qb.query(db, sqlSelect, selection, null, null, null, null);
  c.moveToFirst();
  return c;
  }
</code></pre>

<p>Second method in MainActivity.java</p>

<pre><code>public void getData() {
  db = new MyDatabase(this);
  onSets = db.getSets(toexes_ids, toprog_dif);
  ListAdapter adapter = new SimpleCursorAdapter(this, 
    R.layout.itemsets, onSets, 
    new String[] {"sets_ids", "sets_weight", "sets_ones"},  
    new int[] {R.id.itemsets_ids, R.id.itemsets_weight, R.id.itemsets_ones});
  listSets.setAdapter(adapter);
  db.close();
    }
</code></pre>

<p>Error:</p>

<pre><code>12-29 16:17:09.335: D/dalvikvm(571): GC_CONCURRENT freed 393K, 53% free 2759K/5767K, external 1574K/1802K, paused 5ms+10ms
12-29 16:17:09.355: E/Database(571): close() was never explicitly called on database '/data/data/com.exp.exp_betta/databases/fitsdbsqlite3' 
12-29 16:17:09.355: E/Database(571): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
12-29 16:17:09.355: E/Database(571): at android.database.sqlite.SQLiteDatabase.&lt;init&gt;(SQLiteDatabase.java:1847)
</code></pre>
