title: How to get the row count of a query in Android using SQLite?
body: <p>How do I get the row count of a query in Android using SQLite? It seems my following method does not work.</p>
  
  <pre><code>public int getFragmentCountByMixId(int mixId) {
      int count = 0;
      SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
  
      Cursor cursor = db.rawQuery(
          "select count(*) from downloadedFragement where mixId=?",
          new String[]{String.valueOf(mixId)});
      while(cursor.moveToFirst()){
          count = cursor.getInt(0);
      }
      return count;
  }    
  </code></pre>