Friday, 15 January 2010

java - How to show user input location in Map according to lat, long in android using Google Map v2? -



java - How to show user input location in Map according to lat, long in android using Google Map v2? -

i need display specific location in map according lat,long , display marker on particular location. however, have displayed whole map not getting specific location.

public class mapactivity extends fragmentactivity { googlemap googlemap; markeroptions markeroptions; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.map); intent intent = getintent(); string title = intent.getstringextra("title"); string lat = intent.getstringextra("lat"); string lon = intent.getstringextra("long"); double lon = double.parsedouble(lon); double lat = double.parsedouble(lat); supportmapfragment supportmapfragment = (supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map); googlemap = supportmapfragment.getmap(); googlemap.addmarker(new markeroptions() .position(new latlng(lat, lon)) .title(title)); } }

try out below:

private marker mymarker; mymarker=googlemap.addmarker(new markeroptions() .position(new latlng(lat, lon)) .title(title) .icon(bitmapdescriptorfactory.defaultmarker(bitmapdescriptorfactory.hue_azure)));

java android google-maps

No comments:

Post a Comment