I need to know what class is derived an object of custom controls.
I know the function:
B4X:
If CallBack Is Activity Then
end if
specifically I need to know the class membership of the object that is passed in the custom controls.
B4X:
Public Sub Initialize (vCallback As Object, vEventName As String)
EventName = vEventName
CallBack = vCallback
If CallBack Is Activity Then
Log("è una activita")
else if CallBack Is Panel Then
Log("è un pannello")
End If
End Sub
maybe you can use (or adapt) this routine (it is from module Scale):
B4X:
'Returns True If the View v Is an Activity otherwise False
'Needed to check if the view is a Panel or an Activity
Public Sub IsActivity(v As View) As Boolean
Dim obj As Object
obj = GetParent(v)
If GetType(obj) = "android.widget.FrameLayout" Then
Return True
Else
Return False
End If
End Sub
I need to know what is the parent class of the object, to make the correct cast with the subject "vCallback"
So, how do I know which class an object belongs?
I hope it is clear