I need to use this value for price. So if the user writes 25, I want to load to the database 25.00 and if He writes 25.1, It should be 25.10. I don't know how to do that..actually that's what I do:
EditText cost = findViewById(R.id.cost_single);
// Temp var with the value of the Edit Text
String costTemp = cost.getText().toString();
if(descriptionPayment.length() > 0 && costTemp.length() > 0) {
costPayment= Double.parseDouble(costTemp);
Map<String, Object> payment = new HashMap<>();
payment.put("cost", costPayment);
payment.put("payed by", payedByText);
db.collection("users").document(email).collection("Group").document(groupName)
.collection("Payments").document(descriptionPayment)
.set(payment)
// rest of my code
How can I upload the double value with the 2 decimal places, even if the cost value hasn't any digits after point?