Google maps android api v2 in fragment -
hy everyone....... i've got google maps android api v2
working google maps uses fragmentactivity displaying map want use fragment display map inside m using code
@suppresslint("newapi") @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); try { setcontentview(r.layout.maps); map = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map)).getmap(); marker hamburg = map.addmarker(new markeroptions() .position(hamburg).title("hamburg")); marker kiel = map.addmarker(new markeroptions() .position(kiel) .title("kiel") .snippet("kiel cool") .icon(bitmapdescriptorfactory .fromresource(r.drawable.ic_launcher))); // move camera instantly hamburg zoom of 15. map.movecamera(cameraupdatefactory.newlatlngzoom(hamburg, 15)); // zoom in, animating camera. map.animatecamera(cameraupdatefactory.zoomto(10), 2000, null); } catch (exception e) { // todo auto-generated catch block log.d("error in maps.class = " , e.tostring()); } }
but instead of extending fragmentactivity wanna extend fragment i.e displaying map inside fragment in regard highly appreciated.. in advance.......
if have sucessfully installed new maps v2 library should able extend "supportmapfragment".
the javadoc info available here. http://developer.android.com/reference/com/google/android/gms/maps/supportmapfragment.html
Comments
Post a Comment