views:

46

answers:

1

I see some answers here prefer views over activities as contents of tabs. Correct me if I am wrong. My understanding is that by switching out views, it's possible to keep the navigation flow inside a tab (more user friendly, I think). But I wonder how to manage the view stack then in case of the back button events. Also this could cause one giant Activity with large amount of views, which might not be good.

So I wish to know why exactly views as contents is preferred before I change my current application to this.

Thanks,

+1  A: 

I see some answers here prefer views over activities as contents of tabs.

A lot of those would be mine.

more user friendly, I think

I completely disagree on this point. I feel that trying to fake navigation inside of tabs is a mistake for most mobile applications.

Also this could cause one giant Activity with large amount of views, which might not be good.

If it is too big from a memory standpoint, it will be too complicated from a user's standpoint, and so should be broken up into independent activities (without tabs).

So I wish to know why exactly views as contents is preferred before I change my current application to this.

Using Activities as the contents of tabs makes all of your concerns worse. Using Activities as the contents of tabs takes up more memory, because more Views get created beyond those you declare in an activity. Using Activities as the contents of tabs takes up a few layers more of stack space, one of the most precious commodities in Android. Using Activities as the contents of tabs takes up CPU time, as Android has to unravel your activity to get at the View inside of it, anyway.

I would flip the issue around: nobody has yet to demonstrate to me any advantage to having Activities as the contents of tabs that outweighs these disadvantages.

CommonsWare
Thank you for clarifying this. I am changing the initial content of each tab to a view, and keep the navigation inside of tabs to be activities.
wei