I'm trying to get the sum from the specific column in the database. I think my query is ok but I think it's something wrong with receiving it back. Please direct me to the right way.
Thank you so much in advance.
public static double countPrice (SQLiteDatabase db, int selectedID){
String[] sumPrice = new String[]{"sum(item_price)"};
String selection = "list_id =? AND item_flag =?";
String[] selectionArgs = new String[]{String.valueOf(selectedID), String.valueOf(0)};
Cursor c = db.query(TABLE_NAME, sumPrice, selection, selectionArgs, null, null, null);
double result = c.getCount();
return result;
}