My app has three different Activities that use a SupportMapFragment
. There is a major delay on the first load after starting the app. This slow load time does not occur on subsequent loads, even if I go back and access a completely different Activity (that also contains a map). I'm trying to figure out if this is something that I could fix.
This gist shows how I load the SupportMapFragment
. Using debug points I have determined that the slowness occurs between onViewCreated
and onStart
.
Update 1: Using Debug
I have taken two traces of the first load and second load. The second load is in a completely different Activity
. I quickly noticed that the first trace (the slow load) has a LOT of calls to java/util/zip/zipEntry
. I don't see any calls like that in the second trace. Also, this delay happens between onCreateView
and onViewCreated
of the MapFragment.
Update 2: This also happens with a MapFragment
(not support), except the delay is actually much longer.
Update 3: This SO question seems to be related. Also this one.
SupportMapFragment
or just using it directly? – ScalenusViewPager
, so I load aFragment
that loads and configures theSupportMapFragment
. – BurntViewPager
, without nested fragments. Note that I happen to be usingMapFragment
rather thanSupportMapFragment
, but that should not impact the solution. If you want to use nested fragments in places, go right ahead, but do so only in the absence of less-expensive solutions. – ScalenusViewPager
is in the Activity and theCustomMapFragment
is a direct Fragment. There is still almost a two second delay when first loading. Could this be an issue with theSupportMapFragment
? I could convert since we dropped API 10 support after our last version release. – BurntDebug
I have taken two traces of the first load and second load. The second load is in a completely differentActivity
. I quickly noticed that the first trace (the slow load) has a LOT of calls tojava/util/zip/zipEntry
. I don't see any in the second trace. Also, this delay happens betweenonCreateView
andonViewCreated
. – Burnt