Reputation: 21
Im trying to make a calculator, but after i've formatted the text im getting the output in XX,XX insted of XX.XX which makes the program crash when reusing the number.
My code is:
tempX = Double.parseDouble(xText.getText().toString());
//tempY = Double.parseDouble(yText.getText().toString());
tempA = Double.parseDouble(aText.getText().toString());
tempB = Double.parseDouble(bText.getText().toString());
tempY = tempA * tempX + tempB;
yText.setText(String.format("%.2f", tempY));
Upvotes: 1
Views: 35