I got another question. I need to convert hex values into decimal values. In .net I use val and "&H" plus the hex value. That's all. How do I manage this in B4A? Please help. Thanks a lot.
If the data type Int has the range : 4bytes signed: -2147483648 to 2147483647
Then why can't I get this code to run:
B4X:
Dim s As String
Dim i As Int
s = "80000002" ' 0h80000002 = -2,147,483,646
i = Bit.ParseInt(s,16)
Comp_Gain_Offset.Text = i
I get the error:
B4X:
main_fillspilabels (B4A line: 1328)
i = Bit.ParseInt(s,16)
java.lang.NumberFormatException: Invalid int: "80000002"
at java.lang.Integer.invalidInt(Integer.java:138)
at java.lang.Integer.parse(Integer.java:382)
at java.lang.Integer.parseInt(Integer.java:366)
at anywheresoftware.b4a.keywords.Bit.ParseInt(Bit.java:80)
at ce3.arsham.SmartScale.main._fillspilabels(main.java:2163)
at ce3.arsham.SmartScale.main._spireceive_click(main.java:3296)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:834)
at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:785)
at ce3.arsham.SmartScale.main._cbd_tmr_tick(main.java:1813)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
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:5039)
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)