I'm using MapView
v2 in my application (not MapFragment
) and it's causing a memory leak. The leak occurs when I pass the Activity context to the MapView constructor. If I pass the Application Context to the MapView constructor the memory leak goes away, however the MapView starts performing badly when I scroll the ScrollView it's in.
Here's a snapshot of where the leak is happening:
The relevant code in MapView
is:
public class MapView extends android.widget.FrameLayout {
private final com.google.android.gms.maps.MapView.b gD;
static class b extends com.google.android.gms.dynamic.a<com.google.android.gms.maps.MapView.a> {
private final android.content.Context mContext;
// Here's the Context MapView is leaking
}
static class a implements com.google.android.gms.dynamic.LifecycleDelegate {
// More stuff in here
}
}
I've been messing with MapView
for a few weeks now trying to get it to behave correctly in a ScrollView
, to no avail. I'm about to give up on it.
Also, the snapshot()
method that was recently added isn't an option because I have already tried it, and it doesn't give a reliable snapshot of the map. I have an open question on this here, and another related open question here and here, all of which have not been answered.