MyLocationOverlay and OutOfMemoryError

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

MyLocationOverlay and OutOfMemoryError

Postby kekomal » Wed Apr 28, 2010 1:24 pm

Hello everybody.

I have a MapActivity containing a MapView making use of a MyLocationOverlay. The fact is that my application was suffering an OutOfMemoryError. After a lot of debugging I discovered that it was caused by the MyLocationOverlay. When I entered the MapActivity and went back to the previous Activity, the memory was not correctly cleaned. I don't know the reason, perhaps there is some kind of problem when passing the MapView to the MyLocationOverlay's constructor as a reference and adding the MyLocationOverlay to the overlay list of the MapView (some kind of cross reference). The fact was that after entering and going back from the MapActivity some times, the OutOfMemoryError appeared.

So I decided to make the MyLocationOverlay static so that it is only constructed once. The OutOfMemoryError dissapeared, but now I also need to make the MapView static because I can only pass the reference to the MapView in the MyLocationOverlay's constructor. I don't like much this solution.

Any experience solving this issue?

Junior Developer
Junior Developer
Posts: 19
Joined: Wed Mar 17, 2010 10:44 am
Location: Bilbao, Spain


Return to Map Problems

Who is online

Users browsing this forum: No registered users and 2 guests