i'm trying write simple mapview using google maps api v1 (targeting gingerbread devices)
just tried following example hello-mapview , works apart image not displayed on map.
there overlay, touch works , displays text, how ever no image appears it.
can spot have missed?
mymapview.java
public class mymapview extends mapactivity { private mapview mapview; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); mapview = (mapview) findviewbyid(r.id.mapview); mapview.setbuiltinzoomcontrols(true); list<overlay> mapoverlays = mapview.getoverlays(); drawable drawable = getresources().getdrawable(r.drawable.androidmarker); newoverlay itemizedoverlay = new newoverlay(drawable, this); geopoint point = new geopoint(19240000,-99120000); overlayitem overlayitem = new overlayitem(point, "hola, mundo!", "i'm in mexico city!"); itemizedoverlay.addoverlay(overlayitem); mapoverlays.add(itemizedoverlay); } @override protected boolean isroutedisplayed() { // todo auto-generated method stub return false; } }
newoverlay.java
public class newoverlay extends itemizedoverlay<overlayitem> { private arraylist<overlayitem> moverlays = new arraylist<overlayitem>(); private context mcontext; public newoverlay(drawable defaultmarker, context context) { super(defaultmarker); mcontext = context; } @override protected overlayitem createitem(int i) { return moverlays.get(i); } @override public int size() { return moverlays.size(); } public void addoverlay(overlayitem overlay) { moverlays.add(overlay); populate(); } public void removeoverlays(){ moverlays.clear(); populate(); } @override protected boolean ontap(int index) { overlayitem item = moverlays.get(index); alertdialog.builder dialog = new alertdialog.builder(mcontext); dialog.settitle(item.gettitle()); dialog.setmessage(item.getsnippet()); dialog.show(); return true; } }
Comments
Post a Comment