I have a comparable question:
I have an application that use a map for which each map key value is a list of 5 items, this construction is a bit slow so I decided to save and load this to a map file on the device. I save the map with File.WriteMap there is a file written.
I Load the map. System is still able to find the key as I expect. I have an obejct variable that correctly receives the value, when I cast this on to the list an error occurs despite content of obj seams correct ... Do you have any Idea ?
I only put a code extract, what is also important is the first execution when map file does not exist, the application is perfectly working with the "programatically build map not read from file" ...
Code extract ( as seen on the dump below it crashes on val = obj !)
Dim obj As Object
Dim val As List
[...]
If bestIndex<>-1 Then
obj=myMap.GetValueAt(bestIndex)
val = obj
v3=val.Get(3)
V2=val.Get(2)
V0=val.Get(0)
V1=val.Get(1)
End If
Error dump extract:
main_activity_searchBestValue (B4A line: 315)
val = obj
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
at b4a.example.main._activity_searchBestValue(main.java:452)
at b4a.example.main._btnzoom_click(main.java:913)
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.BA.raiseEvent2(BA.java:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:63)
at android.view.View.performClick(View.java:4091)
at android.view.View$PerformClick.run(View.java:17072)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5000)
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:821)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)
Ooooups I can see from the dump that it is still named "b4a.example.main" ...
