Multiple MapFragments Performance (Android Map API v2)

I searched the docs of the new Google Android Map API v2 but found nothing about it. Before v2, we (officially) were not able to display more than one card per application (process). I assume that implementing MapFragment is no longer a problem. I also know that Fragments can be standalone with API 17. And last but not least, there is a compatibility package that allows you to port all of it back to at least API 8 (in API 7 there is no OpenGL 2.0 to prevent the cards from working afaik).

Sa I have all the components for porting my application to Maps API v2 and implementing the following scenario: ViewPager contains Fragments , and each of them contains MapFragment .

But should I do this? I mean, I ran into performance issues if I had, for example. 20 Fragments containing MapFragments in ViewPager ?

If you find anything that concerns my concern in the docs or elsewhere, let me know.


EDIT: usage example . Imagine a screen containing information about a specific element - a place, event, article. Also imagine that, among other information, it should contain a card that will be fully functional. But I would like the user to be able to carry on another item if he wants. Each item has its own map.

Side note: I know that I can implement one map outside of the ViewPager and just update it based on the currently displayed item, but this is not what I am looking for - it is not a user-oriented design.


Possible solution (but not yet verified). ViewPager stores only a few (by default - 3) fragments in the cache and recreates them when they are about to appear, so there will be no overhead, since only a few MapFragments . The performance issue may be MapFragment inflation, which, in my opinion, is pretty heavy, but this can be resolved using MapFragments recycling.


So why don't I implement it if I believe it will work? There is another problem that MapFragments it impossible to move MapFragments without an application, it seems to be broken. See this .

+6
source share
2 answers

You can easily test it, but I assume that it will be very dependent on the phone, since Maps is still quite difficult to run.

This says that I never recommend this kind of user navigation. The map can already be scrolled, so why would you add ViewPager swipes? This will create a very confusing user interface. If you want to switch between different views / points of interest, you must add buttons (overflow menu buttons, as in a navigation application) or something similar that helps the user navigate.

+1
source

Yes, you would definitely ViewPager performance issues because ViewPager does not use the default view utility; you can even inflate it with ImageView , not to mention MapFragments.

As for caching and re-creating fragments in the ViewPager , there is a HorizontalListView lib, which will probably save you from the effort, as it supports viewing recirculation.

+1
source

All Articles