Reputation: 809
i try to save my String value (50000000)
into Double format, while I'm trying to show it again in my Edittext
, I can't to show it in normal format, and it show as (5E+07)
, is there any way to convert from double format into String format?
I have try this way :
Double value_doble = 5E+07;
EditText.setText(String.valueOf(value_doble);
but its Still show as 5E+07, so my question how to convert from Double to String?
Upvotes: 0
Views: 4714
Reputation: 2276
I agree that you need use Formater http://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html
but the pattern should be look like this:
import java.text.DecimalFormat;
import java.text.NumberFormat;
public class DoubleFormat {
public static void main(String[] args) {
double valueD = 5E+07;
NumberFormat format = new DecimalFormat("#");
System.out.println(format.format(valueD));
}
}
Upvotes: 0
Reputation: 3649
Is this what you are looking for?
public static void main(String[] args) {
Double value_doble = 5E+07;
NumberFormat formatter = new DecimalFormat("###.#####");
String f = formatter.format(value_doble);
System.out.println(f);
}
Upvotes: 1
Reputation: 1854
You can try this:
System.out.println(new BigDecimal(value_doble).toString());
Upvotes: 4