Java mengonversi ganda menjadi string
double total = 44;
String total2 = Double.toString(total);
Manga301
double total = 44;
String total2 = Double.toString(total);
double number = -895.25;
String numberAsString = String.valueOf(number);
totalCost.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
try {
double priceG = Double.parseDouble(priceGal.getText().toString());
double valG = Double.parseDouble(volGal.toString());
double total = priceG * valG;
String tot = new Double(total).toString();
totalCost.setText(tot);
} catch(Exception e) {
Log.e("text", e.toString());
}
return false;
}
});