title: How to show all rows from database
body: <p>In the code below, I'm getting only the last row in my database, i.e. first name and last name of the last row in my DB. My question is: how do I change this code in order to get all the results printed?</p>
  
  <pre><code>package samples.directory;      
  
  import android.app.Activity;
  import android.database.Cursor;
  import android.database.sqlite.SQLiteDatabase;
  import android.os.Bundle;
  import android.webkit.WebView;
  import android.widget.ArrayAdapter;
  import android.widget.TextView;
  
  public class clanguage extends Activity {
  protected Cursor c;
  protected SQLiteDatabase db;
  
  
  protected TextView employeeName;
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.webdesign);
      WebView engine = (WebView) findViewById(R.id.web_engine);
  
      db = (new DatabaseHelper(this)).getWritableDatabase();
  
      Cursor c = db.rawQuery("SELECT firstName, lastName FROM employee", null);
      if (c != null ) {
          if  (c.moveToFirst()) {
              do {
                  String firstName= c.getString(c.getColumnIndex("firstName"));
                  String lastName = c.getString(c.getColumnIndex("lastName "));                                                   
                  String data = "&lt;html&gt;" +
                      "&lt;body&gt;&lt;table border=2&gt; &lt;tr&gt; &lt;td&gt;"+firstName+"&lt;/td&gt;+                                
                      &lt;td&gt;"+lastName+"&lt;/td&gt;&lt;/tr&gt;&lt;/body&gt;&lt;/html&gt;";
  
                  engine.loadData(data, "text/html", "UTF-8");
  
              }while (c.moveToNext());
          } 
      }
  }
  </code></pre>