title: Get data from sqlite database
body: <p>I have an activity and want to get data from my sqlite database. It works, but my activity only retrieves the last row and not the whole column. What can i do to get the whole column?</p>
  
  <p>This is the code in my database:</p>
  
  <pre><code>public String getName() {
  String[] columns = new String[]{ KEY_ROWID, KEY_NAME };
  Cursor c = db.query(NAME_TABLE, columns, null, null, null, null, null);
  c.moveToFirst();
  while(!c.isAfterLast()) {
  String name = c.getString(c.getColumnIndex(KEY_NAME));
  c.moveToNext();
  }
  c.close();
  return name;
  }
  </code></pre>
  
  <hr>
  
  <p>This is the code in my activities to contact the database:</p>
  
  <pre><code>Database getdata = new Database(this);
  getdata.open();
  String data = getdata.getName();
  getdata.close();
  </code></pre>