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?
Regards,
Eneko


