views:

1572

answers:

2

I've read at a few places that I should not be using Activities as contents of my tabs. I would like to know why this is not a recommended approach... Any suggestions?

+2  A: 

Here are some links that may help:

Tabs with Intents
http://www.androidguys.com/2008/12/05/tabs-with-intents/

Start different activities in separate tabs of a TabHost
http://www.androidsnippets.org/snippets/68/

Robert Harvey
Thanks... Just asked Mark about the same thing... In fact, I learnt this technique from Mark himself :)
Legend
+2  A: 

I'd flip it around: why would you want to use activities as tabs? All you do is add overhead and complexity. Just use Views for the tabs.

If you have something that just has to be both a tab and a separate standalone activity, reuse the View.

CommonsWare
Actually I was more tempted by your tutorial (posted by Robert in the previous post)... Correct me if I'm wrong, but by using separate intents for the tabs, I will be doing an on-demand loading. So for instance, if there are three listviews, I will be loading just one... Or is it the same if I use Views as well?I am trying to understand the fundamental difference between using either approach...
Legend
So all I'm seeing is starting one huge activity versus starting an activity on demand... I could be wrong but I'd really appreciate if you can correct me...
Legend
If you want on-demand loading, use a TabContentFactory.
CommonsWare
Thanks a ton! That's exactly the way I was looking for... Just wish Java had partial classes... My main class is growing super huge now...
Legend