When I do an activity.loadlayout() in a sub, does this load a new instance of the layout each time that sub is called? Or does the routine know it is already loaded and just make the current layout active. I'm still trying to understand memory usage in b4a and the best ways to handle it.
Currently, I use panels for most layouts and simply set them to visible or not and sendtoback or bringtofront.
As I understand it, calling activity.loadlayout will just load it again, leaving the old references available for garbage collection.
It will slow down the app as it takes time to load especially if the layout is large. You can check if the layout is loaded by calling isinitialized on any of the views it contains and load it if it returns false.
Since the old layout views are on the Activity, they will still be referenced, so I dont think they will be garbage collected. You will need to remove views from the Activity first.
You can first remove the activity views and then load the layout if you want to load the same layout again (currently I don't see any good reason to do it),