I am trying to move my animation code into a code module as they've been used repeatedly in several activities.
Can I pass the Activity instance into a code module? I am trying the following code
Then I try calling the function from the Activity module using
It doesn't work of course and I get
Any suggestion? Thanks!
Can I pass the Activity instance into a code module? I am trying the following code
B4X:
' In code module
Sub EnterButtonAnim(Anim As AnimationPlus, Act As Activity)
For i = 0 To Act.NumberOfViews - 1
Dim currentButton As Button
If Act.GetView(i) Is Button Then
currentButton = Act.GetView(i)
AnimButtonRight(i+1, Anim)
If Anim.IsInitialized Then
Anim.Stop(currentButton)
Act.Invalidate
Anim.Start(currentButton)
End If
End If
Next
End Sub
Then I try calling the function from the Activity module using
B4X:
catmodule.EnterButtonAnim(AnimButton, Me)
It doesn't work of course and I get
B4X:
Compiling code. 0.03
Compiling layouts code. 0.00
Generating R file. 0.31
Compiling generated Java code. Error
B4A line: 171
catmodule.EnterButtonAnim(AnimButton, Me)
javac 1.6.0_26
src\com\dbcom\findthecat\main.java:455: inconvertible types
found : java.lang.Class<capture#652 of ?>
required: anywheresoftware.b4a.BALayout
mostCurrent._catmodule._enterbuttonanim(mostCurrent.activityBA,mostCurrent._animbutton,(anywheresoftware.b4a.objects.ActivityWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.ActivityWrapper(), (anywheresoftware.b4a.BALayout)(main.getObject())));
Any suggestion? Thanks!