Friday, 15 June 2012

java - Generating Bitmaps with custom text for map markers - OutOfMemoryError -


I have a map view that travels your route in a car, and is a finder that lets you go on the path Allows a map marker to appear at each location with speed at that place, these map markers (bitmaps) are generated at run-time because the speed should be placed on them. The problem I have is that there can be hundreds of places in a journey, for which a new map marker / bitmap can be generated. I am currently creating a new bitmap for each location in an asyncTask, for a long journey, the app force stops due to an outofmme error. I need a way to swap text on map markers so that I create 1 bitmap . Any help / advice is highly appreciated.

When it comes to mobile development, beepmaps are always expensive operations. What I suggest is that you should have a lazy load of the marketer (bitmap). So, what you can do, know the first scene area and limitations related to that range and get the markers only when the map is scrolled in that area. It does not consume in the run-time for your many memories and when required so bring bitmap

Here is a sample code:

  GoogleMap = theMap; LatLngBounds limit = this.theMap.getProjection (). GetVisibleRegion (). LatLngBounds; LatLng placeLL = new Latang (your latitude, your langatoid); If (bounds.contains (placeLL)) {// What do you want to do with markers inside the scene area}  

Hope it helps !!


No comments:

Post a Comment