Is there any issue with using a few different layouts within a single activity or b4i page?
I like a flat single activity for simple apps and usually use different panels within a single layout to facilitate different 'screens' without worrying about activity/page swapping etc, the only downside is that its tricky to preview each 'screen' in the layout designed without changing different panel visibilities.
I was just wondering if instead of each different panel I can just use a different layout and load them up as an when I wish without changing activity/page.
You can use the
RemoveAllViews
and then load the new layout.
But probably you will need to save all the data of every layout of you need to maintain them when showing again.
This fact would be solved by having many panels and showing/hiding then as needed like you are doing.
It depends on what you need to obtain.
Why not use B4XPages? The Activity is still only one.
If you load different layouts, the code you execute will certainly be related only to the current layout and B4XPages help you with this (in addition to having many other advantages).
I like a flat single activity for simple apps and usually use different panels within a single layout to facilitate different 'screens' without worrying about activity/page swapping etc
As @LucaMs implies, what you describe here is also a very good description of B4XPages. So you have a choice of sticking with your current approach, which is probably a little simplistic, has a few snags but which you thoroughly understand, or switching to B4XPages which is more sophisticated and capable, truly cross-platform but will require some investment in learning how to use. Only you know your future plans and are able to judge whether the investment will be worth it.
I have been experimenting with B4Xpages, in my app I don’t particularly want the page back and navigation options - rather full screen (although this may be configurable, not experimented enough yet), and I am not sure if the interaction logic for a layout on a page should be in that pages’ code or in the main page code.
So, it may be the best option but I need to spend more time familiarising myself with that structure to know, which I should probably do.
B4XPages projects will give you many advantages even on single page/layout projects.
Sure it's worth to try and understand them.
Then you will always have the options to stick to Activity projects, or choosing from time to time which one you want to use.