向ContentResolver.query提供列数组时,使用sum()
函数包装列名
String[] columns = new String[] { "sum(" + columnName + ")" };
Cursor cursor = getContentResolver().query(
content_uri,columns,selection,selectionArgs,sort
);
cursor.movetoFirst();
int columnSum = cursor.getInt(0);