android - Zoom GoogleMap to my location -


i have sherlockfragmentactivity displays googlemap using google maps android api v2. want map zoom current location fragment launches. couldn't find such method in documentation. how achieve this?

private googlemap mmap;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.ui_settings_demo);     setupmapifneeded(); }  @override protected void onresume() {     super.onresume();     setupmapifneeded(); }  private void setupmapifneeded() {     // null check confirm have not instantiated map.     if (mmap == null) {         // try obtain map supportmapfragment.         mmap = ((supportmapfragment) getsupportfragmentmanager()                 .findfragmentbyid(r.id.map))                 .getmap();         if (mmap != null) {             setupmap();         }     }  }  private void setupmap() {     mmap.setmylocationenabled(true);     //how zoom current location?   } 

like this

cameraposition position = new cameraposition.builder()         .target(new latlng(lat,lon))         .zoom(zoom).build();       map.animatecamera(cameraupdatefactory.newcameraposition(position)); 

docs


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -