You should use a numeric data type for arithmetic operations (not Object
). With out seeing the code in add()
my recommendation is to store the total price in a double
primitive.
double price =0;
for(int x = 0; x < rprice.size(); x++) {
//you may need to cast/convert here
price += (double)rprice.get(x);
//what does this do????
Object numResult = add(totalPrice, price);
pricelbl.setText(price);
}