Here is my simple code
@Override
public void onClick(View v) {
try {
double price = Double.parseDouble(ePrice.getText().toStr
You can try this DecimalFormat
DecimalFormat decimalFormatter = new DecimalFormat("############");
number.setText(decimalFormatter.format(Double.parseDouble(result)));
I would suggest using BigDecimal
s instead of double
s. That way you will have a more precise control over your calculation precision. Also you can get a non-scientific String
using BigDecimal.toPlainString()
.
Check answer here. You can write
moneyToGet.setText(String.format("%.0f", priceValue));
Use NumberFormater like
NumberFormat myformatter = new DecimalFormat("########");
String result = myformatter.format(yourValue);
DecimalFormat decimalFormatter = new DecimalFormat("##.############");
decimalFormatter.setMinimumFractionDigits(2);
decimalFormatter.setMaximumFractionDigits(15);
This option will help you ##.## suffix 0 before decimal, otherwise output will be .000
btc.setText(decimalFormatter.format(btcval));
use this for displaying content