Multi-Activity App

cruskai239

New Member
Joined
May 15, 2011
Messages
20
Reaction score
0
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?
 

naDroid.com

Member
Joined
Feb 16, 2011
Messages
31
Reaction score
0
Location
Canton, OH
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.
 
Top