I'm trying to register a client on Android's internal DB. I have a String
field where I put the user's phone. This field I convert to Integer using parseInt
newCliente.setFone(Integer.parseInt(foneDesc));
If I register at most two phone numbers for the user it accepts (it was the example I used). But your I type the 9 digits of the phone that is correct it gives error:
FATAL EXCEPTION: main java.lang.NumberFormatException: Invalid int: "4899984829" at java.lang.Integer.invalidInt(Integer.java:138) at java.lang.Integer.parse(Integer.java:378) at java.lang.Integer.parseInt(Integer.java:366) at java.lang.Integer.parseInt(Integer.java:332) at artur.com.decorusfinal.cadastro.CadCliente$btGravar.onClick(CadCliente.java:68) at android.view.View.performClick(View.java:4204) at android.view.View$PerformClick.run(View.java:17355) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5041) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method)
In the error it gives says that problem is in the conversion
newCliente.setFone(Integer.parseInt(foneDesc));
If it had not worked, it would not let me nor even register the user with only 2 phone numbers.