I'm trying to get rid of some of the decimal places in a double,I'v done it successfully on other part's of the app but i cant figure it out here. The double is coming in in a extra and i'm setting it to an edit text
double dryFree = sender.getExtras().getDouble("ResultFree");
else if (getIntent().hasExtra("ResultFree")) {
answer.setText( dryFree + "");
This is what i'v tried but app crashes
else if (getIntent().hasExtra("ResultFree")) {
answer.setText(String.format("%.2f", dryFree + ""));
Activity where number is coming from, I tried using string.format here to but getting errors, I know i'm using it wrong
total = (int) (a * b * c) / 0.424753;
.
stackoverflow.comm
No comments:
Post a Comment