Code Issue In Globals

margret

Well-Known Member
Licensed User
Longtime User
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

This is the first instance in the code to Dim vv. I have cleaned the project, etc. B4A seems to ignore the If condition and tries to Dim both vv's.
 
Top