I'm currently working on an application where we need to show a location using Google maps. We have an if statement that does a Geocoder lookup if we don't have latitude and longitude and if we do have the latitude and longitude it just adds the annotation to the map. The problem is that when we already have the latitude/longitude and we try to add the annotation without any lookups the application crashes with a "Wrapped java.lang.NullPointerException" error - But if we do a lookup first then it works fine. If we do a lookup even if we have the coordinates and just don't use the lookup for anything then it also works - It seems like the lookup delays the function for just a fraction of a second which is enough for it to work.
Trying to use the "complete" event doesn't trigger on Android.
Anybody have an idea for a solution?
To Appcelerator: Could you please work on actually supporting a lot of the events on Android as well - This is the 15th time in the last two days that i need to use an event that doesn't fire on Android. Very very frustrating!
var mapView = Titanium.Map.createView({ mapType: Titanium.Map.STANDARD_TYPE, userLocation:false, top:130, bottom:0, visible:false }); var createAnnotation = function(params) { params.title = params.title ? params.title : data.headline; var annotation = Titanium.Map.createAnnotation({ latitude:params.latitude, longitude:params.longitude, title:params.title, pinImage:"../images/map-pin.png", animate:true }); mapView.addAnnotation(annotation); mapView.region={ latitude: params.latitude, longitude: params.longitude, latitudeDelta:0.05, longitudeDelta:0.05 }; }; if(!data.longitude || !data.latitude) { Titanium.Geolocation.forwardGeocoder(data.address+' '+data.zipcode+', '+data.city,function(response){ createAnnotation({ longitude:response.longitude, latitude:response.latitude }); }); } else { createAnnotation({ longitude:data.longitude, latitude:data.latitude }); } win.add(mapView);