Java Question java.lang.ClassCastException issue when compiling library

raaiman

Member
Licensed User
Longtime User
Hi,

the problem is:
java.lang.ClassCastException: anywheresoftware.b4a.objects.collections.Map cannot be cast to anywheresoftware.b4a.objects.collections.Map$MyMap

please see my code segment:
In Library file,
B4X:
List mConfigureList = new List();mConfigureList.Initialize();
                for(i=0;i<mConfigurations.size();i++){
    Map mp = new Map();mp.Initialize();
    mp.Put("k1", "v1");
    mp.Put("k2","v2");
    mConfigureList.Add(mp);
}
this.mBa.raiseEvent(this, this.eventName+"_showlist", new Object[]{mConfigureList});
In B4A file,
B4X:
Sub myapp_showlist(configurations As List)
    Log("configurations size="&configurations.Size)
    Dim i As Int
    Dim mp As Map
    For i=0 To configurations.Size-1
        mp = configurations.Get(i)
        Log("k1="&mp.Get("k1"))
        Log("k2="&mp.Get("k2"))
    Next
End Sub

what is the problem ?
 
Top