C Creideiki Active Member Licensed User Longtime User May 31, 2013 #1 I get the following error: java.lang.ClassCastException: anywheresoftware.b4a.objects.collections.List cannot be cast to java.util.List What do I do: I have a Service: Code: Copy Sub Process_Globals Dim ToDoList As List End Sub Sub Service_Create ToDoList.Initialize End Sub Sub getAdapterVersion(adap As Object) CallSub2(adap, "readVersion", ToDoList) End Sub getAdapterVersion is called from the Activity with a class object of a class with the following sub: Code: Copy Sub readVersion(tdl As Object) Dim todoList = tdl As List end sub The ClassCastException raises in the line Code: Copy Dim todoList = tdl As List What happens here and what can I do to work around? I can't find anything wrong here; the object is a List from start to end!?
I get the following error: java.lang.ClassCastException: anywheresoftware.b4a.objects.collections.List cannot be cast to java.util.List What do I do: I have a Service: Code: Copy Sub Process_Globals Dim ToDoList As List End Sub Sub Service_Create ToDoList.Initialize End Sub Sub getAdapterVersion(adap As Object) CallSub2(adap, "readVersion", ToDoList) End Sub getAdapterVersion is called from the Activity with a class object of a class with the following sub: Code: Copy Sub readVersion(tdl As Object) Dim todoList = tdl As List end sub The ClassCastException raises in the line Code: Copy Dim todoList = tdl As List What happens here and what can I do to work around? I can't find anything wrong here; the object is a List from start to end!?
warwound Expert Licensed User Longtime User May 31, 2013 #2 Shouldn't that be: Code: Copy Dim todoList As List=tdl Martin. Sent from my GT-I9300 using Tapatalk 2
Shouldn't that be: Code: Copy Dim todoList As List=tdl Martin. Sent from my GT-I9300 using Tapatalk 2
C Creideiki Active Member Licensed User Longtime User Jun 13, 2013 #3 warwound said: Shouldn't that be: Code: Copy Dim todoList As List=tdl Martin. Click to expand... Well... that's both syntactically allowed. And it both doesn't work.
warwound said: Shouldn't that be: Code: Copy Dim todoList As List=tdl Martin. Click to expand... Well... that's both syntactically allowed. And it both doesn't work.
Erel B4X founder Staff member Licensed User Longtime User Jun 13, 2013 #4 You should change the sub signature to: Code: Copy Sub readVersion(tdl As List) Dim todoList = tdl As List end sub It is related to List being a wrapper of a Java list.
You should change the sub signature to: Code: Copy Sub readVersion(tdl As List) Dim todoList = tdl As List end sub It is related to List being a wrapper of a Java list.
C Creideiki Active Member Licensed User Longtime User Jun 13, 2013 #5 Erel said: You should change the sub signature to: Code: Copy Sub readVersion(tdl As List) Dim todoList = tdl As List end sub It is related to List being a wrapper of a Java list. Click to expand... I thought I could only use Object as argument type when I call a sub via CallSub. I'll give it a try. What can I use as argument type when calling with CallSub??
Erel said: You should change the sub signature to: Code: Copy Sub readVersion(tdl As List) Dim todoList = tdl As List end sub It is related to List being a wrapper of a Java list. Click to expand... I thought I could only use Object as argument type when I call a sub via CallSub. I'll give it a try. What can I use as argument type when calling with CallSub??
Erel B4X founder Staff member Licensed User Longtime User Jun 13, 2013 #6 You should explicitly set the types. The only exception is that if the object is stored as an Object (in a List for example) then you should use Object.
You should explicitly set the types. The only exception is that if the object is stored as an Object (in a List for example) then you should use Object.