Hello I have this code which generates an error at initialization. This is the class Icons
How to initialize the first image object (0)?
Main
Class Icons
Log
How to initialize the first image object (0)?
Main
B4X:
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Public MainForm As Form
Private Icons As Icons
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
Icons.Initialize
Icons.CreateIcon
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Class Icons
B4X:
Sub Class_Globals
Private fx As JFX
Private IconHeight, IconWidth As Int = 40
Private IconLeft, IconTop As Int = 100
Private xIcon() As ImageView
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
End Sub
public Sub CreateIcon
xIcon(0).Initialize("")
xIcon(0).Left = 100
xIcon(0).Top = 100
xIcon(0).Height = IconHeight
xIcon(0).Width = IconWidth
Main.MainForm.RootPane.AddNode(xIcon(0), 100,100,40,40)
xIcon(0).SetImage(fx.LoadImage(File.DirAssets,"img.png"))
xIcon(0).Visible = True
End Sub
Log
Last edited: