views:

124

answers:

2

When a TabWidget is using intents to designate the target Activity for each tab, is there any special handling of those Activities on the Activity Stack outside of the default operation?

For Instance, if my app has tabs A, B, and C, and I click them in this order––A, B, A, C, A, B––how will the Activity stack change?

My understanding of the default operation, if startActivity() is called each time on the intent, would have the Stack keep loading up new instances of the activities: A, AB, ABA, ABAC, ABACA, ABACAB

It's hard to believe that's how it works though... Seems like it would be a waste of resources and could be endless. Can anyone tell me how this will actually work?

+3  A: 

For Instance, if my app has tabs A, B, and C, and I click them in this order––A, B, A, C, A, B––how will the Activity stack change?

The TabWidget's inner activities do not go on the stack.

My understanding of the default operation, if startActivity() is called each time on the intent, would have the Stack keep loading up new instances of the activities: A, AB, ABA, ABAC, ABACA, ABACAB

TabWidget does not create new activities on each tab click.

CommonsWare
Interesting. So then ONLY the Activity that has the TabWidget will go on to the stack? Does TabWidget also automatically save the state of which tab is currently selected for when you change tasks and then return?
stormin986
+2  A: 

The Tabwidget is responsible for managing the Activities. All Activities that are not shown are paused and are resumed at the moment the Activity is selected in the Tabhost.

Janusz