title: Android fetch multiple items from sqlite database
body: <p>I was like to update (retrieve and possibly edit) multiple items in an SQLite database without using a for/while/dowhile loop</p>
  
  <p>Is this possible using the Cursor? I would like to limit individuals lookups in the table</p>
  
  <p>Is there some complex Android data object that I can dump all results from an SQL query into, that I could then parse for loop</p>
  
  <p>I've heard about <code>Parceable</code> and serializable objects, but that is sort of what I am using the database for.  </p>
  
  <p>I currently have methods to call elements by an individual row. And I could put that method in a for loop, or I could have Cursor's query be in a for loop BUT I don't want to do that many accesses.</p>
  
  <pre><code>public String fetchDay(long rowId) throws SQLException {
  
      Cursor mCursor =
  
          mapDb.query(true, DAY_TABLE, new String[] {KEY_ROWID, KEY_DAY}, KEY_ROWID + "=" + String.valueOf(rowId), null,
                  null, null, null, null);
      if (mCursor != null) {
          mCursor.moveToFirst();
      }
      String result = mCursor.getString(mCursor.getColumnIndex(KEY_DAY));
      mCursor.close();
      return result;
  
  }
  </code></pre>
  
  <p>How would I get all the elements of that table and store in in a complex object without looping</p>
  
  <p>Insight appreciated</p>