Android Question Brainstorming: How to solve my problem.

Blueforcer

Well-Known Member
Licensed User
Longtime User
Hello together,

im struggeling for days solving my problem.

I really want to use B4Xpages, because its easier to keep the views when the app is rotating/resizing.
The Maingoal is to have a app framework like the picture below.
So the header and sidebar is static and the B4XPages are rendered in the content panel
The Sidebar is made with the B4XDrawer.

1645537291317.png


You need to know:
The GUI is mainly generated dynamically by a json at the start of the application. This json sets all the sidebar items, theme, content of each b4xpage and so on.
Also my custom backend is genereated by json. For example logics, hardwarebus and so on.
The App will run on an industrial panel and will act as a PLC to control a bunch of busdriven devices for watertreatment and electrolysis. So its very important that the app will always run for 100%, even if the app is in the background or changing the orientation.


Try 1:
Load the layout in the activity with b4xdrawer and header, and initialize the B4XPagesManager with the ContentPanel

Advantages:
  • The Sidebar and Header is always visible and instanced only once
  • I can switch the B4XPage by choose one from the sidebar, without breaking the user experience (New page shown up in the background, after some millisecons the sidebar closes animated.
Disadvantages
  • If i rotate the phone, it destroys all the views in the main activity, and need to setup again. This would destroy several classes( (for example some intelligent in the header) wich needs working in the background all the time, without too loose it for a short time. Also the Sidebar is destroyed and needs to build up again (this is not a layout, its generated from a json). Also all the color theming is gone and need to set again

Try 2:
Building a class wich contains the whole framework and instanciate and place it to every singe B4Xpage

Advantages:
  • All views, and classes are kept at anytime
Disadvantages
  • The intelligent views are running multiple times, but they shouldn't. wich could cause a much higher RAM usage as needed for some classes.
  • The B4XDrawer removes immediately when you call a new b4xpage. This doesnt look nice
  • You need to parse all current states of the sidebar to every b4xpage in order to keep the highlighted Item etc.



As you can see, i tried the only both variants i could find here in the forum.
But im not happy with any of the results.
Does anyone knows a even better way to reach my goal?

i really appreciate any of your help
 
Last edited:

Blueforcer

Well-Known Member
Licensed User
Longtime User
Ok found another important information:


For now I maybe will fix the orientation and let the user sets it in the settings with a managed restart after that.
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
Hello together,

im struggeling for days solving my problem.

I really want to use B4Xpages, because its easier to keep the views when the app is rotating/resizing.
The Maingoal is to have a app framework like the picture below.
So the header and sidebar is static and the B4XPages are rendered in the content panel
The Sidebar is made with the B4XDrawer.

View attachment 125934




Try 1:
Load the layout in the activity with b4xdrawer and header, and initialize the B4XPagesManager with the ContentPanel

Advantages:
  • The Sidebar and Header is always visible and instanced only once
  • I can switch the B4XPage by choose one from the sidebar, without breaking the user experience (New page shown up in the background, after some millisecons the sidebar closes animated.
Disadvantages
  • If i rotate the phone, it destroys all the views in the main activity, and need to setup again. This would destroy several classes( (for example some intelligent in the header) wich needs working in the background all the time, without too loose it for a short time. Also the Sidebar is destroyed and needs to build up again (this is not a layout, its generated from a json). Also all the color theming is gone and need to set again

Try 2:
Building a class wich contains the whole framework and instanciate and place it to every singe B4Xpage

Advantages:
  • All views, and classes are kept at anytime
Disadvantages
  • The intelligent views are running multiple times, but they shouldn't. wich could cause a much higher RAM usage as needed for some classes.
  • The B4XDrawer removes immediately when you call a new b4xpage. This doesnt look nice
  • You need to parse all current states of the sidebar to every b4xpage in order to keep the highlighted Item etc.



As you can see, i tried the only both variants i could find here in the forum.
But im not happy with any of the results.
Does anyone knows a even better way to reach my goal?

i really appreciate any of your help
see:
can be the starting point for what you want
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
see:
Thanks, but think this is not related to my main problem. I cant remove the views
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
So after trying to make it crossplatform, the next big problem appear.
I forgot how B4XPages works in B4J: totally different, instead to projecting the pages on the target view. it opens new windows. wich is of course not how my app should work.
I will start again from the beginning...

Edit:
I modified the B4XPage lib further so it works in the same way as in B4A. Lets move on...
 
Last edited:
Upvote 0
Top