I have value String "2248880.0" , i want to convert to Long in android with code :
Long.parseLong( "2248880.0"); But I have get Error
java.lang.NumberFormatException: Invalid long: "2248880.0"
so How to fix it ?
java.lang.NumberFormatException: Invalid long: "2248880.0" NumberFormatException is an Exception that might be thrown when you try to convert a String into a number, where that number might be an int , a float , or any other Java numeric type.
At first remove .
Then Use.
long YourLongObj = Long.parseLong("Your_string");
Please read How can I convert String to Double without losing precision in Java
double d= Double.parseDouble("2248880.0");