Design strategies (building blocks)

luke2012

Well-Known Member
Licensed User
Longtime User
I have to implement a multi-page app and I thinking about the best strategy to design it.

The structer is like : 1 menu ---> pages

Strategy 1:
- 1 Activity
- 1 Layout and 1 Panel for each app's page
- So n. Layouts = n. Panels = n. pages

Stragegy 2:
- 1 Activity and 1 Layout for each app's page
- So the n. Activities = n.Layouts = n. Pages

Strategy 3 : Any ideas for other solutions ?

Which solution make sense ? And Why ?

P.S.
One million dollars question
 

Ricky D

Well-Known Member
Licensed User
Longtime User
I personally use strategy 2.

on some of my activities I have popup panels.

Use layouts to handle portrait/landscape orientation.

Regards Ricky
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I would suggest you Strategy 2.
That's the way how Android basically works.
One of the advantages is when you rotate the device the last activity will be restored. With panels it's up to you to manage what panel was currently displayed and then make sure that this one will be displayed.
When I began with B4A I tended to use one Activity and several Panels, but then I changed to adopt the Android strategy

Best regards.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Likewise, multiple activities.

I have a large app (my first with B4A written a year + ago) that I split into multiple activities where I thought the logic would be best served. But some activities also had multiple panels, and when an app grows and develops the code grows too. It would have been easier had I set panels per activity at a lower level.

Using code modules you can share code that is common to activities.

It just makes life easier.
 
Upvote 0

luke2012

Well-Known Member
Licensed User
Longtime User
thanks to all or the reply

So the winner is : Strategy 2

Pro :
- When device is rotated the last activity will be restored
- Things that are taken care automatically like the back button
- The logic would be best served

Cons :
?
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
Also one thing thats happened to me is that I can add an activity in have created for one application and its layout file and use it straight away. Has come in very handy.

Regards Ricky
 
Upvote 0

luke2012

Well-Known Member
Licensed User
Longtime User
For example :
if the user open 3 activities then work in the last and then press the back button the last activity (n.3) is closed/backgrounded by the system and the 2° activity will be restored automatically ? And so on ... ?

It's correct ?
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
Different approach

Hi,

I have done 1 activity per page but now have chosen a different approach. I'm using the PagerView library to create a slick swipe left|right app. that is all embedded in one activity. Sure I see advantages of several activities but for my particular purpose this works best. Especially the code can be a mess but on the other hand code modules can help with that. Even when using several activities the code can be a mess because you have to take care of transformation of data between activities.

In the end what counts is the user experience.

Are there any performance advantages by using several activities? Erel?

For now in this case I stick to one activity (except for a few things like help screens etc.). Majority of apps. have between 1-5 screens and that is not much.

For the rest I try to stick to the ICS guidelines.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…