problems with map overlay items

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

problems with map overlay items

Postby chouman » Wed Dec 17, 2008 9:54 am

I have quite some trouble to get the markers to show up for some
reasons.

This is what i have done:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public void addOverlayBusinessItems()
  3.  
  4.     {
  5.  
  6.         Drawable defaultMarker = getResources().getDrawable
  7.  
  8. (R.drawable.pin);
  9.  
  10.         defaultMarker.setBounds(0, 0, defaultMarker.getIntrinsicWidth(),
  11.  
  12. defaultMarker.getIntrinsicHeight());
  13.  
  14.  
  15.  
  16.         myMapView.getOverlays().add(new MyItemizedOverlay
  17.  
  18. (defaultMarker));
  19.  
  20.         myMapView.postInvalidate();
  21.  
  22.     }
  23.  
  24.  
  25.  
  26.  class MyItemizedOverlay extends ItemizedOverlay<OverlayItem>
  27.  
  28.     {
  29.  
  30.         //create a list of overlay items from the JSON response we get
  31.  
  32. from Yelp
  33.  
  34.         private List<OverlayItem> mItemList = new ArrayList<OverlayItem>
  35.  
  36. ()
  37.  
  38.  
  39.  
  40.         public MyItemizedOverlay(Drawable defaultMarker)
  41.  
  42.         {
  43.  
  44.                 super(defaultMarker);
  45.  
  46.  
  47.  
  48.                 GeoPoint gp = new GeoPoint(5309691, 8851933);
  49.  
  50.                 mItemList.add(gp, "test", "first marker");
  51.  
  52.  
  53.  
  54.                 populate();
  55.  
  56.         }
  57.  
  58.  
  59.  
  60.         @Override
  61.  
  62.         protected OverlayItem createItem(int index)
  63.  
  64.         {
  65.  
  66.                 return mItemList.get(index);
  67.  
  68.         }
  69.  
  70.  
  71.  
  72.         @Override
  73.  
  74.         public int size()
  75.  
  76.         {
  77.  
  78.                 return mItemList.size();
  79.  
  80.         }
  81.  
  82.     }
  83.  
  84.  
Parsed in 0.035 seconds, using GeSHi 1.0.8.4

yet nothing shows up on the my mapview. Are there more that i need to
do?
chouman
Developer
Developer
 
Posts: 27
Joined: Thu Jan 03, 2008 2:59 pm

Top

Postby ndroid » Fri Dec 19, 2008 6:08 am

you need to write draw function for that.
ndroid
Junior Developer
Junior Developer
 
Posts: 15
Joined: Mon Dec 15, 2008 1:29 pm

Postby dmt » Thu Jan 08, 2009 3:04 am

Did you already get it working?

If not, try replacing
' mItemList.add(gp, "test", "first marker") '
with
' mItemList.add(new OverlayItem(gp, "test", "first marker")) '
User avatar
dmt
Junior Developer
Junior Developer
 
Posts: 15
Joined: Mon Jan 05, 2009 6:06 am

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 1 guest