1

In my app, I have a custom made tab control and handle showing the content that corresponds to a tab when a tab is tapped. Each tab is also associated with an activity. However, the content for that activity is only the section of the screen that shows the tab's content.

I have a view for the tab's content that essentially acts as a container. At the moment, when you select a tab, I programmatically set the visibility of all the views within this container to GONE, making them invisible and then set the visibility of the currently selected view to VISIBLE. This all works but it leaves me wondering about what Google's documentation refers to as "embedded activities".

I was under the impression that once I launched one of these embedded activities, the content associated with that activity would come to the foreground and the content from the last activity would go behind it, essentially making it invisible. And when this activity is closed, the content associated with that activity would disappear and then the previous activity would show along with its content. In other words, Android handles the switching of content in relation to its activity.

As it stands, I am manually setting the visibility of each view. Normally, if an activity has content that takes up the entire screen and then the activity closes, the entire content disappears and the UI reverts back to the last activity and its content. But I am dealing with multiple activities sharing the same section of the screen which is only a portion of the screen. Maybe the terminology "embedded activities" is incorrect but that comes straight from Google's documentation. Maybe I just don't understand how views and embedded activities are suppose to interact.

I should also point out that I would prefer to find a solution that works with Android 1.5. I came across something called Fragments that might be what is used to handle automatic creation and destruction of views but I am not sure. Even if it did, it's for Honeycomb. Currently I am using ActivityGroup to handle multiple activities but just came across the documentation that says its deprecated.

Johann
  • 1,977
  • 3
  • 19
  • 18

1 Answers1

0

It seems likely that this answer to "using ActivityGroup to embed activities" should give you what you need.

Community
  • 1
  • 1
cdhabecker
  • 1,693
  • 1
  • 14
  • 23
  • I actually read that post and used the solution provided. That solution however clearly shows manually adding an activity's view to a container. This does not address my question on whether Android is capable of handling these views automatically. As far as I've understood, if you add the view to the container, you have to remove it unless there is some mechanism that handles this that I am not aware of. – Johann Jul 18 '11 at 17:13
  • Ah. Wasn't sure from the OP that you were even using ActivityGroup yet. So you're successfully starting multiple embedded activities in an ActivityGroup container. Why do you expect the ActivityGroup container to act like the standard window system? If it did, ActivityGroup would not be useful for displaying multiple embedded activities at once. – cdhabecker Jul 19 '11 at 06:36
  • I disagree on that. Since I had to write my own code to handle the switching of views for activities in an activity group where the views are embedded, you would think that this is a common practice among many developers and that Android would have that feature built-in. – Johann Jul 19 '11 at 10:15
  • It appears that you now know the analogy: activity-layout is to ActivityGroup as view is to ViewGroup. And you got it to work. At this point, perhaps you should log an enhancement request to change the behavior. – cdhabecker Jul 19 '11 at 16:08