title: Performance of multiple MapFragments (Android Map API v2)
body: <p>I searched the docs of the new <a href="https://developers.google.com/maps/documentation/android/" rel="nofollow noreferrer">Google Android Map API v2</a>, but didn't find anything about it. Before v2 we (officially) couldn't properly display more than one map per application (process). I assume that with <code>MapFragment</code> implementation it's no longer an issue. I also know, that <code>Fragments</code> can be self-contained since API 17. And, last but not least, there is compatibility package, which makes it possible to port it all back to at least API 8 (in API 7, there's no OpenGL 2.0 so the maps wouldn't work afaik).</p>
  
  <p>Sa I have all the ingredients to port my app to Maps API v2 and implement the following scenario: <code>ViewPager</code> contains <code>Fragments</code> and each of them contains a <code>MapFragment</code>.</p>
  
  <p>But should I do it? I mean, <strong>would I face performance issues</strong> if I had e.g. 20 <code>Fragments</code> containing <code>MapFragments</code> in a <code>ViewPager</code>?</p>
  
  <p>If you found anything that addresses my concern in the docs or somewhere else, please tell me.</p>
  
  <hr>
  
  <p><strong>EDIT: Example usage</strong>: Let's imagine a screen containing informations about some specific item - place, event, article. Also let's imagine that, among other informations, it must contain a map to be fully functional. But I would like the user to be able to swipe to another item if he wants. Each item has its own map.</p>
  
  <p>Side note: I know that I can implement one map outside the <code>ViewPager</code> and just update it based on the currently displayed item, but it's not what I'm looking for - it's not user-centered design.</p>
  
  <hr>
  
  <p><strong>Possible solution</strong> (but not checked yet). <code>ViewPager</code> only keeps a few (default - 3) Fragments in it's cache and recreates them when they're about to show up, so there won't be much memory overhead as only a few <code>MapFragments</code> are needed. The performance problem may be the <code>MapFragment</code> inflation which is quite heavy, I believe - but that can be solved with recycling of <code>MapFragments</code>. </p>
  
  <hr>
  
  <p>So why won't I implement it if I believe it will work nice? There's another problem which makes it impossible to move <code>MapFragments</code> without the app look like it's broken. <a href="https://stackoverflow.com/questions/14419521/moving-mapfragment-surfaceview-causes-black-background-flickering">See this</a>.</p>