This started happening after I upgraded to v7.80, and was working fine in my last version. When including a compiled B4A library (Project, compile to library) I am getting a java.lang.ClassCastException in the compiled library. This same library works fine when ran in the test program I create it with (debug or release). With the following code in the library itself:
I pass in "Me" for the callback object from my activity and a base event prefix, I do not have a "prefix_DropdownOpened" in my activity. The log output from the run is:
If I comment out the "If SubExists(..." block then the library performs as expected with no event handler in the activity. It should be noted that adding a "DropDownOpened" block event handler in the activity does not prevent the error.
B4X:
' Class Globals definitions:
Private moCallBack As Object
Private msBaseEvent As String
' internally generated control event handler:
Private Sub lblDropDown_Click
ShowList
If moCallBack <> Null Then
MyLog("Callback not null")
If SubExists(moCallBack, msBaseEvent & "DropdownOpened") Then
MyLog("Sub exists - " & msBaseEvent & "DropdownOpened")
CallSubDelayed(moCallBack, msBaseEvent & "DropdownOpened")
End If
End If
End Sub
I pass in "Me" for the callback object from my activity and a base event prefix, I do not have a "prefix_DropdownOpened" in my activity. The log output from the run is:
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Callback not null
java.lang.ClassCastException: anywheresoftware.b4a.BALayout cannot be cast to java.lang.String
If I comment out the "If SubExists(..." block then the library performs as expected with no event handler in the activity. It should be noted that adding a "DropDownOpened" block event handler in the activity does not prevent the error.