multi-page app using multiple activities or just one?

Dave O

Well-Known Member
Licensed User
Longtime User
I'm just starting work on an Android app that uses several screens, where you're basically drilling down a tree of data, and each level is a listview.

I suppose I could do this with separate activities for each screen, or just 1 activity where I show/hide various panels.

Is there a "proper" way to do this? Any particular trade-offs for using activities vs. panels?

(Eventually I'd like to add the well-known "slide right/left" effect as I drill up and down. Does that affect the activity/panel decision as well?)

Any help much appreciated!
 

barx

Well-Known Member
Licensed User
Longtime User
I'm just doing something similar and wondered the same thing. in the end I went for activities but using the same layout file (just changing the data that is loaded into listview. I chose this because the back button works automatically. With panels you would have to trap the back buttons trigger event and also remember the 'path back' is that makes sense. Which panels to go back to.
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
I prefer the multiple activities too, helps keep the code cleaner

Sent from my DROIDX
 
Upvote 0

Dave O

Well-Known Member
Licensed User
Longtime User
Just tried 2 activities (one for each listview), each with their own layout, using StartActivity and Activity.Finish to move back and forth.

Works well, keeps its state properly without fiddling, and I even get the left/ride slide for free (I assume it's the Android default for switching activities using these commands.)

Thanks!
 
Upvote 0
Top