android - Google maps Pushpin Error -
i want show particular location on map , on perticular location want put pushpin notification. have tried below code showing nullpointer exception please me add markers.
public class mapdemoactivity extends mapactivity { mapview mapview; mapcontroller mc; geopoint p; class mapoverlay extends com.google.android.maps.overlay { @override public boolean draw(canvas canvas, mapview mapview, boolean shadow, long when) { super.draw(canvas, mapview, shadow); //---translate geopoint screen pixels--- point screenpts = new point(); mapview.getprojection().topixels(p, screenpts); //---add marker--- bitmap bmp = bitmapfactory.decoderesource( getresources(), r.drawable.pushpin); canvas.drawbitmap(bmp, screenpts.x, screenpts.y-50, null); return true; } } public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); mapview = (mapview) findviewbyid(r.id.mapview); mapview.setbuiltinzoomcontrols(true); mc.animateto(p); mc.setzoom(17); //---add location marker--- mapoverlay mapoverlay = new mapoverlay(); list<overlay> listofoverlays = mapview.getoverlays(); listofoverlays.clear(); listofoverlays.add(mapoverlay); mapview.invalidate(); } @override protected boolean isroutedisplayed() { // todo auto-generated method stub return false; }
this link may useful you
https://github.com/commonsguy/cw-advandroid/tree/master/maps/nooyawktouch/
Comments
Post a Comment