Issue with SubExits and Activity/Object

EduardoElias

Well-Known Member
Licensed User
Longtime User
I got really confused with this problem, could not find on the forums.

In class module I pass the Activity and Module (that was should be the same)

Public Sub Initialize(aModule As Object, aParent As Activity)
FModule = aModule
FParent = aParent


in the activity_create I use like this:

class.Initialize(me, Activity) (for my understanding both are the same, but)

If I use the FParent (activity)

If SubExists(FParent, "AddProcess") Then
Return CallSub2(FParent, "AddProcess", AppId)

I get this error:
java.lang.ClassCastException: anywheresoftware.b4a.BALayout cannot be cast to java.lang.String

However if I use the FModule (object) it works fine.

Both was supposed to go the same place. I see in some places saying that this should work. I was not passing both parameters before, then I started doing so only to have this problem workaround. I need the activity to deal with the addview. It looks strange both. This class will be at the end compiled to be a library.

I wonder if I could get a clarification on that.

Thanks

Eduardo Elias
 
Top