Titanium Community Questions & Answer Archive

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

Problems with Android map generation with annotations

Hi,

I have a problem for three day with Android and google maps.
I have an applicaction that first takes some data from a web in php, then create annotations with this data and finally it creates the map with this points.

In iPhone it works normally but in Android it shows me the next error and I have to close the app:

The application "xxx" has stopped unexpectly. Please try again.

Here is the code the main code:

http://pastie.org/1284683

And the functions that I call to create annotations and the map

function creaAnotacion(indice, fruteria){
    var anotacion = Titanium.Map.createAnnotation({
        Id:fruteria.Id,
        latitude:fruteria.lat,
        longitude:fruteria.lng,
        title:'Fruter\xeda',
        pincolor:Titanium.Map.ANNOTATION_RED,
        //pinImage:'../images/map-pin.png',
        animate:true,
        datos: fruteria,
        rightButton:'../images/platano.png',
        myid:1 // CUSTOM ATTRIBUTE THAT IS PASSED INTO EVENT OBJECTS
    });
    return anotacion;
}
function creaMapa(posicion, anotaciones){
        //Titanium.API.info("creando mapa "+posicion[0]+"-"+posicion[1]);
        var vista = Titanium.Map.createView({
            mapType: Titanium.Map.STANDARD_TYPE,
            region: {
                latitude: posicion[0],
                longitude: posicion[1],
                latitudeDelta: 0.01,
                longitudeDelta: 0.01
            },
            animate: true,
            regionFit: true,
            userLocation: true,
            annotations: anotaciones
        });
    }
    return vista;
}

If I create the map out of onload function and without annotations, it works well.

I appreciate some help with this problem.

Thanks!

— asked November 9th 2010 by Enric Herce
  • android
  • maps
  • problems
1 Comment
  • I have a similar issue, I am trying to add annotations, and all I get is TypeError:Cannot call method "addAnnotation" of undefined?

    — commented November 16th 2010 by Justin Howard

0 Answers

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.