I am attempting to add and initialize a B4X ImageView in code, as such:
However, its crashing at: Image1.mBase.Top = Settings.Top
With this error: Caused by: java.lang.RuntimeException: Object should first be initialized (B4XView).
Which basically indicates mBase, or etc isnt initialized. But, I did initialize it at the top in code.
Thoughts?
B4X:
'Renders a resized image
Private Sub Draw_imageresized(ArgumentMap As Map)
Dim Property As ControlProperties = ArgumentMap.Get("Property")
Dim Graphic As GraphicObject = ArgumentMap.Get("GraphicObject")
'define and initialize the image view
Dim Image1 As B4XImageView
Image1.Initialize(Me,"")
'Determine if we are going to resize to the full screen
If Property.DisplayName.ToLowerCase = "fullscreen" Then
Image1.mBase.Top = Settings.Top
Image1.mBase.Left = Settings.Left
Image1.mBase.Width = Settings.Width
Image1.mBase.Height = Settings.Height
Else
Image1.mBase.Top = Property.Top*Settings.ScaleY
Image1.mBase.Left = Property.Left*Settings.ScaleX
Image1.mBase.Width = Property.Width*Settings.ScaleX
Image1.mBase.Height = Property.Height*Settings.ScaleY
End If
'Store the image into a file from the Object ID of the current graphic object, then import and rescale.
Image1.Bitmap = fx.LoadImageSample(File.DirTemp,CallSub3(Callback, "ReturnImageAsFile", Graphic.ObjectID, Graphics), Image1.mBase.Width, Image1.mBase.Height)
'Attach the image to the main parent view
ScorePanel.AddNode(Image1.mBase, Image1.mBase.Left, Image1.mBase.Top, Image1.mBase.Width, Image1.mBase.Height)
End Sub
However, its crashing at: Image1.mBase.Top = Settings.Top
With this error: Caused by: java.lang.RuntimeException: Object should first be initialized (B4XView).
Which basically indicates mBase, or etc isnt initialized. But, I did initialize it at the top in code.
Thoughts?