Text not displaying on Map Overlays

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

Text not displaying on Map Overlays

Postby behrapps » Thu Oct 21, 2010 1:22 am

I have just started using maps in my app and I am able to display a map for a specific area with the drawable icon showing the exact location. The problem is I don't see any text next to the marker like you do with google maps. Is this possible? Based on the documentation, it looked like either the title or snippet text you send to the OverlayItem would display but that is not the case. Below is the code that I am using:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. class InterestingLocations extends ItemizedOverlay<OverlayItem> {    
  2.       private List<OverlayItem> locations = new ArrayList<OverlayItem>();  
  3.       private Drawable marker;  
  4.      
  5.       public InterestingLocations(Drawable defaultMarker, int LatitudeE6,
  6.         int LongitudeE6) {  
  7.           super(defaultMarker);    
  8.           this.marker = defaultMarker;    
  9.           GeoPoint myPlace = new GeoPoint(LatitudeE6, LongitudeE6);  
  10.           locations.add(new OverlayItem(myPlace , title, snippet));  
  11.           populate();  
  12.       }      
  13.    
  14.       @Override  
  15.       protected OverlayItem createItem(int i) {
  16.         return locations.get(i);  
  17.       }  
  18.      
  19.       @Override  
  20.       public int size() {  
  21.         return locations.size();  
  22.       }  
  23.      
  24.       @Override  
  25.       public void draw(Canvas canvas, MapView mapView, boolean shadow) {
  26.         super.draw(canvas, mapView, shadow);      
  27.         boundCenterBottom(marker);  
  28.       }
  29.     }
  30.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
behrapps
Freshman
Freshman
 
Posts: 7
Joined: Thu Sep 23, 2010 1:46 am

Top

Re: Text not displaying on Map Overlays

Postby dmurarik » Thu Oct 28, 2010 4:46 pm

override the draw method for your map overlay and use

Code: Select all
canvas.drawText("text",pixel X,pixel Y, Paint);
dmurarik
Freshman
Freshman
 
Posts: 8
Joined: Tue Oct 26, 2010 6:02 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 3 guests