I am using the class in an array declared as global.
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim ct(4) As ClassTest
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
ct(0).Initialize
'ct(0).destroy or reinitialize
'ct (1), ct (2) and ct (3) must remain intact.
End Sub
I thought of creating a temporary array, declaring the original array again, and copying the items from the temporary array I want to keep to it.