private SQLiteDatabase db;public long getCountsTable(String tableName){
String sql = "SELECT COUNT(*) FROM "+tableName;
SQLiteStatement statement = db.compileStatement(sql);
long count = statement.simpleQueryForLong();
return count;
}
注:量少时可以这样,量大时上电时获取,然后添加时加1,这样不用多次去取,因为取一次的时间比较长