Open top menu


Explain- How to used Decimal Integer Value in android?

The NumberFormatException occurred when we are  add Decimal value in EditText and Decimal type String Value Convert  in integer.


java.lang.NumberFormatException: Invalid int: "171."

String d=9.90;
int value=new Double(d).intValue();


try....

String amount=171.234;

txt_toatalcost.setText(amount);

amountadult= new Double(txt_toatalcost.getText().toString()).intValue();


//Avoid this...specialy when you used decimal type value.
// amountadult= Integer.parseInt(textTotalAmount.getText().toString());


Thank you for watching... 
Tagged

0 comments