Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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);
— asked July 15th 2010 by Den Cambodia
  • android
  • geolocation
  • map
0 Comments

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

    — answered July 15th 2010 by Christian Sigl
    permalink
    0 Comments
  • sorry accidental double-post

    — answered July 15th 2010 by Christian Sigl
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.