我试过这个来获取行数。但是程序挂了。
private int countbaglist()
{
int count = 0;
SQLiteDatabase db = datasource.getWritableDatabase();
Cursor cursor = db.rawQuery(
"select count(*) from shoplist where itemname=?",
new String[] { String.valueOf("itemname") });
while(cursor.moveToFirst())
{
count = cursor.getCount();
}
return count;
}