title: How to retrieve data from cursor?
body: <pre><code>public String getSum(String code) 
  {
          SQLiteDatabase db = this.getReadableDatabase();
      Cursor cursor =db.query(TABLE_OWNER, new String[] { KEY_SUM }, KEY_CODE + "=?", new String[] { code }, null, null, null, null);
      String data = cursor.getString(cursor.getColumnIndex("data"));
          return data;
      }
  </code></pre>
  
  <p>I would like to get the data "KEY_SUM", but it is failure to get it. How can I do so ?</p>
  
  <pre><code>public String getSum(String code) {
      SQLiteDatabase db = this.getReadableDatabase();
  
  
      Cursor cursor =db.query(TABLE_OWNER, new String[] { KEY_SUM }, KEY_CODE + "=?", new String[] { code }, null, null, null, null);
  
      String data = "0";
      if (cursor.moveToFirst()) 
      { 
          data = cursor.getString (cursor.getColumnIndex (KEY_SUM));
      }
      return data;
  }
  </code></pre>
  
  <p>After I implement like that I can't get value too. I only get the 0.</p>