What's new
DroidForums.net | Android Forum & News

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Multi-Activity App

cruskai239

New Member
I'm making an application that will have multiple pages. I've thought up two ways to do this.

#1: Use different activities and intents (the way every tutorial does it).

#2: Use a switch statement to "simulate" changing pages on the button push without actually changing activities.


Which is more efficient for both speed and file size?
 
Just a thought

Not sure which is more efficient or if the difference in file size would even be noticeable but I would advise against this. The reason everyone does it in separate activities is because that is just the proper way to do it.

This makes your code both more readable and more maintainable.
In my experience it also makes your code less prone to bugs that can be introduced in complicated if/switch blocks.

Just my 2 cents though. If it's easier for you and you are the only person that will ever touch it, then do it how you want. I just don't think you should base it off of an efficiency question since any difference will not be noticeable.
 
Back
Top