Hello,
I created a map and I populated it like this:
B4X:
map.Put("2016062309343853.jpg", "c:\desktop")
When I want to retrieve the key value, i do this
B4X:
Dim i as int
i = 0
map.GetKeyAt(i)
but I get this error log:
B4X:
java.lang.NumberFormatException: Invalid double: "2016062309343853.jpg"
at java.lang.StringToReal.invalidReal(StringToReal.java:63)
at java.lang.StringToReal.parseDouble(StringToReal.java:269)
at java.lang.Double.parseDouble(Double.java:295)
at it.android.imgspa.and_FotoContainer.svcupload._smb1_listcompleted(svcupload.java:409)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.BA$3.run(BA.java:320)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5297)
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:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
I read that:
The key should be a string or a number. The value can be any type of object.
Your file name used for the key is evaluated as being a number, a double due to the "decimal" point, so the conversion from string to doubke fails for what is the file extension but it is read as the decimal part of your double.
Your file name used for the key is evaluated as being a number, a double due to the "decimal" point, so the conversion from string to doubke fails for what is the file extension but it is read as the decimal part of your double.
I guess the problem arises because the filename part is an all-digits one so something looks at it like a number and having a full stop between filename and extension that makes it for a decimal number so the conversion routine from string to double which obviously fails.
Try without the full stop and it will work..just for testing.
I guess the problem arises because the filename part is an all-digits one so something looks at it like a number and having a full stop between filename and extension that makes it for a decimal number so the conversion routine from string to double which obviously fails.
Try without the full stop and it will work..just for testing.
Your file name used for the key is evaluated as being a number, a double due to the "decimal" point, so the conversion from string to doubke fails for what is the file extension but it is read as the decimal part of your double.
Reading post #9 it seems that the problematic programs sportse two code blocks supposed to be identical, where only one causes the error. If this is the case I'll try to figure out the difference between the two since @eurojams code works properly and the OP confirms it.