I have the following code in Android Studio.
public void addTotal() {
String sub1 = subtotal1.getText().toString();
String newSub1 = sub1.replace("$", "");
String sub2 = subtotal2.getText().toString();
String newSub2 = sub2.replace("$", "");
String sub3 = subtotal3.getText().toString();
String newSub3 = sub3.replace("$", "");
totalAmt.setText(newSub1 + newSub2 + newSub3);
}
I have not been able to add them as integer. Am I missing anything?
subtotal1
, subtotal2
, subtotal3
are TextView
in the app.