Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14761

Android: Ti.Map is unable to access getAnnotations() method

    Details

      Description

      Problem

      When I attempt to access annotations on a map view created by Ti.Map in Alloy I find that the annotations are undefined, however they are displayed on the map. I do not have this issue when creating the map using the traditional method.

      I need to be able to get all the current annotations and loop through them, I have tried using the getAnnotations() method but no results are returned.

      This issue does not exist with the map on iOS.

      Below is the code to reproduce this issue.

      alloy.js

      alloy.js

      Alloy.Globals.Map = require('ti.map');
      

      index.xml

      index.xml

      <Alloy>
          <Window>
              <!-- Use the Alloy.Globals.Map namespace to create a map module view -->
              <View id="mapview" ns="Alloy.Globals.Map" onClick="report" />
          </Window>
      </Alloy>
      

      index.js

      index.js

      function report(evt) {
          Ti.API.info("Annotation " + evt.title + " clicked, id: " + evt.annotation.myid);
      }
       
      // API calls to the map module need to use the Alloy.Globals.Map reference
      var mountainView = Alloy.Globals.Map.createAnnotation({
          latitude:37.390749,
          longitude:-122.081651,
          title:"Appcelerator Headquarters",
          subtitle:'Mountain View, CA',
          pincolor:Alloy.Globals.Map.ANNOTATION_RED,
          myid:1 // Custom property to uniquely identify this annotation.
      });
       
      $.mapview.region = {latitude:33.74511, longitude:-84.38993,
                          latitudeDelta:0.01, longitudeDelta:0.01};
      $.mapview.addAnnotations([mountainView]);
       
      alert($.mapview.getAnnotations().length);
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hpham Hieu Pham
                Reporter:
                g0ld2k Chris Golding
                Reviewer:
                Ping Wang
              • Watchers:
                0 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-17145
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code