我想在android中计算表格的行数。我使用了2种方法但没有成功并收到警告消息
Launch timeout has expired, giving up wake lock!
Activity idle timeout for HistoryRecord{44e26a30 com.india.screen/.CategoryList}
我试过了-
String query="Select count(*) from Holyplace_Tbl";
使用 rawQuery
公共无效countRows(字符串查询){
Cursor mcursor = assetDatabaseHelper.executeQuery(query); mcursor.moveToFirst(); int icount = mcursor.getInt(0); System.out.println("NUMBER IN DB: " + icount); mcursor.close();
}
使用 DatabaseUtils
public int countRows(String query) { int sometotal = (int) DatabaseUtils.longForQuery(sqliteDatabaseObj, query, null); return sometotal; }