0

I am embarrassed to say how long I have been struggling with this problem and I hope there is an easy fix, because as far as I can tell I have tried nearly everything.

The app is developed with SDK 5.1.0 for android, using the latest Ti.Map module. It is a classic application.

The mapview calls an route/polyline object from a different file using require (kept separate for tidyness, it is a large polyline of about 7000 points and in some cases there are several smaller lines).

The mapview also runs through an array to populate the annotations, and to change those annotations as the user scrolls.

Everything works great in iOS, but on Android not so much.

But the way that it fails is most curious, and perhaps someone here can tell me why: At the time the app launches, visiting the mapview shows the correct annotations and the correct route/polyline. If I then change views to another screen and return to the map, the annotations remain correct but the route/polyline disappears.

Any idea why? Which is preferred, addRoute or addPolyline? I have tried both.

1 Answers1

0

Another long day banging my head against the wall to sort out titanium woes. Here is the hack I came up with for this one.

After creating the mapview I add the following lines of code to add, then remove, then add again, the routes in question; and I set all of that in a setTimeout.

setTimeout(function() {
        mapview.addRoute(route1);
        mapview.addRoute(route2);
        mapview.addRoute(route3);

        mapview.removeRoute(route1);
        mapview.removeRoute(route2);
        mapview.removeRoute(route3);        

        mapview.addRoute(route1);
        mapview.addRoute(route2);
        mapview.addRoute(route3);
}, 0); 

Best of luck to anyone else who struggles with this, and I am interested to hear of any other hacks of the mapping sort.