Kevin M
Kevin M

Reputation: 347

can anyone give any insight into this issue on my android app - java.lang.NumberFormatException

Here is the stack traces from android crash report. I have 6 crash reports with this stack trace provided by google. Individuals comment on what happened but they do not tell any details on the screen what they were doing etc. can any one decipher this and possibly give me a general course of action to eliminate this issue. My app is a calculator using trig functions.

java.lang.NumberFormatException: unable to parse '2.625' as integer
at java.lang.Integer.parse(Integer.java:383)
at java.lang.Integer.parseInt(Integer.java:372)
at java.lang.Integer.parseInt(Integer.java:332)
at com.pipe.fittings.kevin.All_angle_pipe_all_angle$10.onClick(All_angle_pipe_all_angle.java:236)
at android.view.View.performClick(View.java:2485)
at android.view.View$PerformClick.run(View.java:9089)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3806)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)`enter code here`

Upvotes: 0

Views: 93

Answers (2)

Balaswamy Vaddeman
Balaswamy Vaddeman

Reputation: 8540

use double i=Double.parseDouble(str); instead of Integer.parseInt.

Upvotes: 0

kosa
kosa

Reputation: 66677

In your code you are trying to parse double value using Integer.parseInt which is wrong. You need to use double temp = Double.parseDouble(s); if you want double.

If you want int, int temp2 = Double.intValue(temp);

Upvotes: 2

Related Questions