Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9877] Android: Titanium.Map - Create annotation method does not work on button click eventlistener.

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2012-11-01T22:38:59.000+0000
Affected Version/sRelease 2.1.0
Fix Version/s2012 Sprint 23 API, 2012 Sprint 23
ComponentsAndroid
Labelsapi
ReporterAnshu Mittal
AssigneePing Wang
Created2012-07-05T03:57:41.000+0000
Updated2013-11-07T18:48:17.000+0000

Description

Create annotation method does not work on button click eventlistener. This is not regression. This also occured on 2.0.2 Steps to reproduce: 1. Create an app using the code below. 2. Launch the app. 3. Click on 'Add annotations' button. Expected: Annotation should be added. Actual: Annotation is not added.

var win = Ti.UI.createWindow({
    backgroundColor: 'white'
});
 
var button = Ti.UI.createButton({
    title: 'Add Annotations',
    top: 10,
    left: 10,
    height: 40,
    width: 200
});
var mapView = Titanium.Map.createView({
    top: 50,
    mapType: Titanium.Map.STANDARD_TYPE,
    region:{latitude:37.390749,longitude:-122.081651,animate:true,latitudeDelta:0.04, longitudeDelta:0.04},
    animate:true,
    regionFit:true,
    userLocation:true,
});
button.addEventListener('click', function(){
    var mountainView = Titanium.Map.createAnnotation({
        latitude:37.390749,
        longitude:-122.081651,
        title:"Appcelerator Headquarters",
        subtitle:'Mountain View, CA',
       animate: true,
        image: 'appicon.png'
    });
    mapView.annotations = [mountainView];
});
 

 
win.add(button);
win.add(mapView);
 
win.open();

Comments

  1. Ping Wang 2012-11-01

    Tested with latest master and 3_0_X branch. The annotation is added to the map view as expected. Mark the ticket as Cannot Reproduce.
  2. Anshu Mittal 2013-04-10

    Tested with: SDK: 3.1.0.v20130409124549 Studio:3.1.0.201304011603 Device: Samsung galaxy tab(v 3.2) OS: OSX 10.7.5 Cannot reproduce the issue. annotation adds successfully

JSON Source