Center fixed marker in android v2 mapview -


i want set fixed marker in center point of mapview while dragging map.it has been done @ android map v1 google mapview. it's deprecated.now question is, possible in android map v2 google mapview ?(i have tried.but map doesn't show)

i'm betting used getmapcenter() which, per google maps android v2, no longer available use. no worries, use this:

googlemap.getcameraposition().target 

it return latlng object represents center of map. can use reposition marker center every time there's drag event assigning oncamerachangedlistener googlemap.

yourgmapinstance.setoncamerachangelistener(new oncamerachangedlistener() {     @override     public void oncamerachange (cameraposition position) {          // center of map.         latlng centerofmap = yourgmapinstance.getcameraposition().target;          // update marker's position center of map.         yourmarkerinstance.setposition(centerofmap);     } }); 

there. hope helped!


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

How do you convert a timestamp into a datetime in python with the correct timezone? -