0

In my google maps activity,the map is shown based on the current position.So i need to adjust the zoom controls of the map so that my current point and target point is always visible in the map.I think i need to be more specific.ie,I have a target address that is shown by an overlay image.My current position is focused on the map.So as I move away from the target,I need to adjust the zoom controls so that the target is still visible.Similarly,When I move close to target,I need to zoom in.

siraj
  • 461
  • 2
  • 6
  • 17

2 Answers2

0

Use the following methods of MapView:

mapView.getController().setZoom(13); // set the zoom level here 
mapView.getController().setCenter(point);

where mapview is the instance of MapView.

Hope this is what you want.

Dinesh Sharma
  • 11,533
  • 7
  • 42
  • 60
  • but setting zoom to a particular point does not show my target.I need to show my target and current position despite of distance between them. – siraj Nov 08 '11 at 05:29
  • If you want show your current position & target at the same screen, I dont think that will be feasible if the distance is too long. I dont think you can control this. – Dinesh Sharma Nov 08 '11 at 05:32
  • i don't want to see the exact directions.I just want to zoom out and in according to my distance from the target. – siraj Nov 08 '11 at 05:34
  • I am not getting you properly . Please make it clear that what you exactly want and explain it properly. – Dinesh Sharma Nov 08 '11 at 05:38
  • Ok. My application has several users and they will be having some target address to complete their tasks.So currently the map will show their current position.S my aim to adjust the zoom controls by the application itself so that destination and his current position are visible in the map.This will help to identify how far he is from the destination.Hope u get it!! – siraj Nov 08 '11 at 05:47
0

Check this answer here they have given code to zoom to the level to show each Overlay Marker drawn on the map so each of them are visible..may be this can solve your problem

LINK TO THE QUESTION

Community
  • 1
  • 1
MKJParekh
  • 34,073
  • 11
  • 87
  • 98