title: Selecting one row from sqlite database using rawQuery and rowid in Android
body: <p>I've created an external SQLite database that looks something like this: <a href="https://i.stack.imgur.com/FlYw3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FlYw3.png" alt="image of a few rows of a database" /></a></p>
  <p>What I want to do in my Android application is to load all the values from one row using ROWID and put them into array. For example:</p>
  <pre><code>Cursor cursor = db.rawQuery(&quot;SELECT * FROM Dairy WHERE ROWID = 1&quot;, null);
  </code></pre>
  <p>This would return all the values from row 1: 51, 35, 63. However, this always returns just first value, in this case 51. Also, the <code>cursor.getCount()</code> always returns 1.</p>
  <p>Here's my complete code:</p>
  <pre><code>db = getReadableDatabase();
  
  Cursor cursor = db.rawQuery(&quot;SELECT * FROM Dairy WHERE ROWID = 1&quot;, null);
  
  yData = new int[cursor.getCount()];
  
  if (cursor.moveToFirst()) {
      for (int i = 0; i &lt; cursor.getCount(); i++) {
          yData[i] = cursor.getInt(0);
          cursor.moveToNext();
      }
      cursor.close();
  }
  db.close();
  </code></pre>