Android Question Deinitialization of a user class.

Sergey_New

Well-Known Member
Licensed User
Longtime User
How can you deinitialize a custom class without closing the activity in which it was initialized?
 
Solution
If you declare the instance again without initialization, it is not initialized.
But it is unusual to need to do this!

B4X: Copy
    Dim sl As SuperList
    sl.Initialize(Me, "")
    Log(sl.IsInitialized)    'True
  
    Dim sl As SuperList
    Log(sl.IsInitialized)    'False
What do you mean?
After initializing the class, the program will execute some code, after which deinitialization of the class is a condition for continuing the program.
The question is simple - is it possible or not to deinitialize a class?
 
Upvote 0
try this:
Code: Copy
Dim MyClass As MyCustomClass
MyClass.Initialize

' ...........  other code

' try this for to deinitialize:
MyClass = Null
 
Upvote 0
try this:
This is the first thing I did.
Raises an error after checking
B4X: Copy
MyClass = Null
If MyClass.IsInitialized Then ...
I will need to introduce a boolean variable when initializing the class and use it.
 
Last edited:
Upvote 0
Back
Top