title: SQLite database query returns only one row
body: <p>Below is the code I'm using to grab all results stored in an SQLite table. The problem I am having is that it is only returning a single row when I know there are 21 rows in the DB.</p>
  
  <pre><code>public HashMap&lt;String, String&gt; fetchResults(String TABLE_NAME, String sql) {
      HashMap&lt;String, String&gt; table = new HashMap&lt;String, String&gt;();
      if(sql == null)
          sql = "";
      String selectQuery = "SELECT * FROM " + TABLE_NAME + " " + sql;
  
      SQLiteDatabase db = this.getReadableDatabase();
      Cursor cursor = db.rawQuery(selectQuery, null);
  
      String[] columns = null;
      switch(TABLE_NAME ){
      case "projects":
          columns = dbTables.projectsColumns;
          break;
      }
  
  
  
      // Move to first row
      cursor.moveToFirst();
      if (cursor.getCount() &gt; 0) {
  
          int n=1;
          for(int i=0; i&lt;columns.length; i++){
              table.put(columns[i], cursor.getString(n));
              n++;
          }
  
      }
      //move to the next row 
      cursor.moveToNext();
  
      cursor.close();
      db.close();
      // return user
      Log.d(TAG, "Fetching " + TABLE_NAME + " from Sqlite: " + table.toString());
  
      return table;
  }
  </code></pre>
  
  <p>The db call is made within a fragment and look like this.</p>
  
  <pre><code>HashMap&lt;String, String&gt; projects = db.fetchResults(dbTables.TABLE_PROJECTS, null);
  
  
      for (String key : projects.keySet()) {
  
          if(key == "projectname"){
              System.out.println("Key: " + key + ", Value: " + projects.get(key));
              menuList.add(projects.get(key));
          }
      }
  </code></pre>