Wednesday 15 May 2013

google maps - How do I change the characters in the middle of a String in Java? -


I have a string that acts as the URL of a googleMaps image in my interface, and I change it It should be enabled at arbitrarily at the zoom level, I have found:

  string coordinates = latitude + "," + longitude; String URL = "http://maps.googleapis.com/maps/api/staticmap?centre=" + Coordinate + "and Zoom = 12 & Size = 400x400 and Markers = Color: Red;" + Coordinate;  

Where the zoom level on the image is determined by the number after the "& amp; zoom =" tag, how can I change this number efficiently?

The Java string is irreversible, so you can only change it by overwriting the whole string. However, you can see static parts as

  string urlFirstPart = "http://maps.googleapis.com/maps/api/staticmap?center=" + coordinatess + "& amp; zoom =" Can save in; String urlLastPart = "& amp; Size = 400x400 and marker = color: red |" + Coordinate;  

and then by zoom

  url = urlFirstPart + zoom + urlLastPart   to zoom Update url for  

No comments:

Post a Comment