Map View errors when I used it for the second time
Hi
I have records on the table list contains data that has latitude & longitude on the listing widow. When I click on each row, it passes to the detail window that display the mapview and its annotation of that record.
I zoom in & out, moved to different area and I clicked "back" button to go back to the record list.
Then, I selected on the different record to see the map on the detail window again, when I'm on the detail window suddenly I clicked on the map, there, it alerts me an error message which did not mention about the specific issues.
Thank you very much and I can post the code if you are interested to this issue.
Here is my code:
listingAnnotation = Titanium.Map.createAnnotation({
pincolor: Titanium.Map.ANNOTATION_RED,
latitude: latitude,
longitude: longitude,
animate: true
});
region = {
latitude: latitude,
longitude: longitude
};
if(!mapview){
mapview = Titanium.Map.createView({
top: 130,
bottom: 0,
animate:true,
mapType: Titanium.Map.STANDARD_TYPE,
region: {latitude: latitude, longitude: longitude},
annotations: [listingAnnotation]
});
}
else{
mapview.removeAllAnnotations();
mapview.setLocation(region);
mapview.addAnnotation(listingAnnotation);
}
listingDetailWindow.add(mapview);
2 Answers
-
Accepted Answer
hi,
there is a undocumented fix for this!
add an eventListener for the window "close"-event and put the following code in it
mapview.onDestroy();
this worked for me, however there may be sideeffects
-
sorry accidental double-post