B4J Question Multiple code modules with forms

mc73

Well-Known Member
Licensed User
Longtime User
Ok, I can add forms to modules, show them, close them. Now, if for e.g. I have a timer in the second module, it still runs while I've closed the form. I know this is logical, yet, how do I unload the whole module? I want not any source to continue running taking up resources. In Vb I would write an "unload me", in b4a an "activity.finish". In b4j?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Activity.Finish is equivalent to Form.Close. It will not stop a timer for you. In Android the whole components life cycle is much more complicated. So while the timer keeps on running the events are not raised.

You will need to disable the timer when the form close. If you want to clear all global variables together with the form then you should use a class instead of a static module. Then you can just more remove the reference to the class instance and all its variables will eventually be released.
 
Last edited:
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
More the reference?
Anyway, I suspected it should be done manually, it's not a problem.

Irrelevant: Just secs ago, I added a tableView in a form, tried generating members, then everything went red. Removed dimming the view, still red. See attached screenshot.
 

Attachments

  • mdr.jpg
    28.3 KB · Views: 342
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Nope, as I said, red's still there. Not to worry, surely it'll be fixed
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
'Problem' disappeared after creating a new project and reloading the old one. BUT while reloading the old one, I mean before creating a new one, the problem was there.
The procedure was creating a new class, then adding a button. So far so good. Then, I placed a tableView, saved the layout and upon generating members, everything went red.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…