Search code examples
androiddictionaryandroid-activitysubactivity

Displaying a MapView with a SubAcivity


I have a main activity. its main.xml generates a view that holds a slider, which on click, reveles some area for conent. In this area I want to display a map. so I need a second activity. I am able to call the sub activity but I want it to be displayed in the area of the slider of the main.xml, however the map has its own mapview.xml.

any ideas?



Solution

  • While it's true that you need a MapActivity in order to display a map, from what you describe I'm not convinced you actually nest Activities. There's nothing about MapActivity that requires that the XML not already have content area with a map in it.

    If you really do want to use a MapActivity as a sub-activity, then you should use an ActivityGroup. The classic example of this is a TabActivity, which can have multiple Activities (one in each tab) - you could look at TabActivity's source code to determine how this is done.