Reputation: 609
In my application I am fetching value from local database.I have rounded up that value and it showing "1756637.36" which is correct.But when I am fetching it in activity it's showing "1.75664e+06" which is correct but with exponential character I want to show double value.
I have also used Decimal Format but it's not working which is as below....
DecimalFormat myFormatter3 = new DecimalFormat("#.##");
availableQtyArrayList.add(myFormatter3.format(Double.parseDouble(farmerCursor.getString(farmerCursor.getColumnIndex("AvailableQty")))));
Upvotes: 1
Views: 1096
Reputation: 942
Try this example.
public class Formatter {
public static void main(String[] args) {
Double d = 1756637.36234;
DecimalFormat formatter = new DecimalFormat("#############.##");
System.out.println(formatter.format(d));
}
}
Upvotes: 1
Reputation: 41200
Use pattern #######.##
instead of #.##
.
DecimalFormat myFormatter3 = new DecimalFormat("#######.##");
Upvotes: 0