Search code examples
androidandroid-activitytabwidgetactivity-stack

TabWidget Activity Handling - Does it Create a New Activity EVERY Time?


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?


Solution

  • 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.