I have an If block as listed below in the Globals sub of the Main Activity. I need to Dim vv based on the SDK being used. This code throws an error and will not run. Can we not use an IF statement in Globals?
B4X:
If ph1.SdkVersion >= 14 Then
Dim vv As VideoViewExt
Else
Dim vv As VideoView
End If
Compiling code. Error
Error compiling program.
Error description: Current declaration does not match previous one.
Previous: {Type=VideoView,Rank=0}
Current: {Type=VideoViewExt,Rank=0}
Occurred on line: 74
Dim vv As VideoViewExt
The compiler must know the actual type of each variable during compilation. You will need to declare two variables and then to use the correct one based on the SdkVersion.