title: Android- Getting a single value from a database table using cursor
body: <p>I'm using cursors to retrieve data from a database. I know how to retrieve entire columns to use on listviews and such, but I'm struggling to find a way to retrieve a single value. </p>
  
  <p>Let's say I have a table with two columns ("_id" and "Name") and I have ten records (rows) in that table. How would I get, for example, the Name in the third row? Considering I defined a cursor that reads that table:</p>
  
  <pre><code>public Cursor getMyNameInfo() {
  
      SQLiteDatabase db = getReadableDatabase();
      SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
  
  
      String sqlTables = "MyNames";
      qb.setTables(sqlTables);
      Cursor c = qb.query(db, null, null, null,
              null, null, null);  
  
      c.moveToFirst();
      return c;
      }
  </code></pre>