android - stop panning to my location after camera update -
i have set map points marked on works fine. open map , move , zoom location. problem when pan location, after moment takes me location. how move , zoom , release move @ location.
here code move , zoom:
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(); mmap.setmylocationenabled(true); // check if successful in obtaining map. if (mmap != null) { setupmap(); mmap.setonmylocationchangelistener(new googlemap.onmylocationchangelistener() { @override public void onmylocationchange(location arg0) { // todo auto-generated method stub latlng mylocation = new latlng(arg0.getlatitude(), arg0.getlongitude()); mmap.setmaptype(googlemap.map_type_normal); cameraupdate update = cameraupdatefactory.newlatlngzoom(mylocation, 11); mmap.movecamera(update); mmap.addmarker(new markeroptions() .position(mylocation) .title("brian here!")); } }); } } }
i think easy cannot find answer.
any appreciated.
you can "easily" solve, if want go location @ every change, code correct, if don't want, problem in camera change when location changes.
you can once set location listener did, , @ end of animation remove listener. run animation first time, , then, since listener removed, avoid again move location.
Comments
Post a Comment