title: SQLite Count Rows Android
body: <p>I think I have got a script that will work for this, but im struggling to get the value out into a variable and post it into a textview and eventually compare it to another integer.</p>
  
  <pre><code>    private SQLiteDatabase mDatabase;
  
  private long fetchPlacesCount() {
      String sql = "SELECT COUNT(*) FROM " + DB_TABLE;
      SQLiteStatement statement = mDatabase.compileStatement(sql);
      return (int) statement.simpleQueryForLong();
  
  }
  </code></pre>