Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2236] Android: Can't Update Properties of a Map Annotation

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-07-11T23:19:11.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 2.1.0, Sprint 2012-11 API
ComponentsAndroid
Labelsapi, module_map, qe-testadded, training
ReporterDon Thorp
AssigneePing Wang
Created2011-04-15T03:14:26.000+0000
Updated2012-07-12T11:49:10.000+0000

Description

Updating the properties (ex: title, subtitle) of an annotation proxy are being ignored.

Test Case

var win = Ti.UI.createWindow();

var mountainView = Titanium.Map.createAnnotation({
    latitude:37.390749,
    longitude:-122.081651,
    title:"Appcelerator Headquarters",
    subtitle:'Mountain View, CA',
    pincolor:Titanium.Map.ANNOTATION_RED,
    animate:true,
    leftButton: '../images/appcelerator_small.png',
    myid:1 // Custom property to uniquely identify this annotation.
});

var mapview = Ti.Map.createView({
	width: 500, height: 500,
	mapType: Titanium.Map.STANDARD_TYPE,
	region: {latitude:37.390749, longitude:-122.081651, 
	         latitudeDelta:0.01, longitudeDelta:0.01},
	annotations: [mountainView]
});
win.add(mapview);

mapview.addEventListener('click', function(e) {
	alert("click! annotation = " + e.annotation);
	e.annotation.title = "Found it!";
        e.annotation.subtitle = "Works!";
});

win.open();
1. Try clicking the annotation. 2. An alert should pop up saying "click". 3. Check if the title and subtitle got updated. Expected: title and subtitle changed Actual: No changes happen, property updates ignored.

Comments

  1. Josh Roesslein 2012-05-17

    Updated this ticket with test case since the linked HD ticket is long gone. This actually affects all properties on annotation in current master branch.
  2. Ping Wang 2012-05-24

    Test case:
       var win = Ti.UI.createWindow({
       	backgroundColor: 'black'
       });
       
       var b = Ti.UI.createButton({
       	top: 100,
       	title: "change annotation"
       });
       b.addEventListener('click', function() {
           alert("click! annotation.title = " + mountainView.title);
           mountainView.title = "Found it!";
           mountainView.subtitle = "Works!";
       });
       win.add(b);
        
       var mountainView = Titanium.Map.createAnnotation({
           latitude:37.390749,
           longitude:-122.081651,
           title:"Appcelerator Headquarters",
           subtitle:'Mountain View, CA',
           pincolor:Titanium.Map.ANNOTATION_RED,
           animate:true,
           leftButton: '../images/appcelerator_small.png',
           myid:1 // Custom property to uniquely identify this annotation.
       });
        
       var mapview = Ti.Map.createView({
           width: 500, height: 500,
           mapType: Titanium.Map.STANDARD_TYPE,
           region: {latitude:37.390749, longitude:-122.081651, 
                    latitudeDelta:0.01, longitudeDelta:0.01},
           annotations: [mountainView]
       });
       win.add(mapview);
        
       win.open();
       
    For functional test: 1. click the pin to see the annotation title and subtitle. 2. click the button. 3. click the pin to check whether annotation title and subtitle are changed. Expected: The title and subtitle are changed.
  3. Ping Wang 2012-05-24

    PR https://github.com/appcelerator/titanium_mobile/pull/2270
  4. Dustin Hyde 2012-06-15

    Closing as Fixed. Verified via a modified version of Ping's code (below). The code was changed to fix the layout across screen-sizes, and prevent an emulator crash (TIMOB-9585) for non-existent image resources. SDK: 2.1.0.v20120615150353 Studio: 2.1.0.201206141932 OS: Snow Leopard Runtime: V8 Devices Tested: Android Emulator 2.2, LG Revolution 2.3.6 Test Case: 1. Run code:
       var win = Ti.UI.createWindow({
           backgroundColor: 'black',
           layout:'vertical'
       });
        
       var b = Ti.UI.createButton({
           title: "change annotation"
       });
       
       b.addEventListener('click', function() {
           alert("click! annotation.title = " + mountainView.title);
           mountainView.title = "Found it!";
           mountainView.subtitle = "Works!";
       });
       
       win.add(b);
         
       var mountainView = Titanium.Map.createAnnotation({
           latitude:37.390749,
           longitude:-122.081651,
           title:"Appcelerator Headquarters",
           subtitle:'Mountain View, CA',
           pincolor:Titanium.Map.ANNOTATION_RED,
           animate:true,
           myid:1
       });
         
       var mapview = Ti.Map.createView({
           mapType: Titanium.Map.STANDARD_TYPE,
           region: {latitude:37.390749, longitude:-122.081651, 
                    latitudeDelta:0.01, longitudeDelta:0.01},
           annotations: [mountainView]
       });
       
       win.add(mapview);
         
       win.open();
       
    2. click the pin to see the annotation title and subtitle. 3. click the update button. 4. click the pin to check whether annotation title and subtitle are changed. Expected: The title and subtitle are changed.
  5. Neha Chhabra 2012-07-11

    Reopening to update labels.

JSON Source