Closed GoogleCodeExporter closed 9 years ago
One way to handle this is to declare field marked 'final' to make a copy of the
address string, then you can reference it from inside your LocationCallback
implementation. In the example below, I did this twice, to reference an
InfoWindow
object as well:
private void displayWithGeocoder(InfoWindow w, String address) {
final String addressCopy = address;
final InfoWindow wCopy = w;
Geocoder g = new Geocoder();
g.getLocations(address, new LocationCallback() {
public void onFailure(int statusCode) {
GWT.log("Error: "+statusCode+" Failed to retrieve address: "+addressCopy,
null);
}
public void onSuccess(Placemark[] locations) {
GWT.log("Got "+locations.length+" locations returned. Address is " +
addressCopy,
null);
if (locations.length > 0) {
wCopy.open(locations[0].getPoint(),
new InfoWindowContent("Found :" + locations[0].getAddress()));
}
}
});
}
Original comment by gwt.team...@gmail.com
on 14 Jan 2008 at 3:58
Now I am thinking we should change this callback model to use the handler/event
pattern that we're putting in to support GEvent.
Original comment by galgwt.reviews@gmail.com
on 5 Apr 2008 at 3:53
If we do this, we will need to look at the following types which use a callback
pattern:
DirectionsCallback, LatLngCallback, LocationCallback, GeoXMLLoadCallback
Original comment by stxmen...@gmail.com
on 23 Jul 2008 at 2:40
The Maps v2 API is now deprecated.
Original comment by zundel@google.com
on 28 May 2010 at 6:15
Original issue reported on code.google.com by
ebesse...@gmail.com
on 19 Sep 2007 at 1:38