[TIMOB-10296] Android: Annotations with the same title cannot be uniquley selected. The first is always selected.
GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-09-04T00:26:03.000+0000 |
Affected Version/s | Release 2.1.0 |
Fix Version/s | Sprint 2012-16 API, Release 2.1.2, Release 3.0.0 |
Components | Android |
Labels | SupportTeam, api, module_map, qe-review, qe-testadded |
Reporter | Varun Joshi |
Assignee | Vishal Duggal |
Created | 2012-08-01T16:10:04.000+0000 |
Updated | 2012-09-04T00:26:03.000+0000 |
Description
Issue
On Android if we have annotations with the same title, only 1st of the annotations with the title can be selected. In iOS the correct annotation is selected, even if the titles are the same. It would make more sense to have annotations identified by the titleid instead of the title since the title can be the same.
Sample Code
In the attached code there are 4 annotations created with unique titleid's. On iOS, when the Select Annotation button is clicked Citibank #3 is selected (which is correct). On Android however the first annotation with that title is selected so Citibank #1 is selected.
{noformat}
var win = Ti.UI.createWindow({
backgroundColor : 'white'
});
win.open();
//create object instance, a parasitic subclass of Observable
var self = Ti.UI.createView();
win.add(self);
var mapObject = Titanium.Map.createView({
mapType : Titanium.Map.STANDARD_TYPE,
animate : true,
regionFit : true,
userLocation : true,
top : '150',
height : '400dp',
zoomEnabled : true,
region : {
latitude : 37.77501,
longitude : -122.419,
latitudeDelta : 0.01,
longitudeDelta : 0.01
},
});
mapObject.addEventListener('click', function() {
alert('map clicked');
});
var selectAnnotations = Ti.UI.createButton({
title : "Select Annotations",
top : '0',
});
var annotations = []
annotations[0] = Titanium.Map.createAnnotation({
animate : true,
title : 'Citibank',
subtitle : '#1',
id : '1',
pincolor : Titanium.Map.ANNOTATION_RED,
latitude : parseFloat(37.776),
longitude : parseFloat(-122.419),
image : '/images/locPin.png'
});
annotations[1] = Titanium.Map.createAnnotation({
animate : true,
title : 'Citibank',
subtitle : '#2',
id : '2',
pincolor : Titanium.Map.ANNOTATION_RED,
latitude : parseFloat(37.77501),
longitude : parseFloat(-122.419),
image : '/images/locPin.png'
});
annotations[2] = Titanium.Map.createAnnotation({
animate : true,
title : 'Citibank',
subtitle : '#3',
id : '3',
pincolor : Titanium.Map.ANNOTATION_RED,
latitude : parseFloat(37.770),
longitude : parseFloat(-122.419),
image : '/images/locPin.png'
});
annotations[3] = Titanium.Map.createAnnotation({
animate : true,
title : 'Citibank',
subtitle : '#4',
id : '4',
pincolor : Titanium.Map.ANNOTATION_RED,
latitude : parseFloat(37.770),
longitude : parseFloat(-122.43),
image : '/images/locPin.png'
});
mapObject.addAnnotation(annotations[0]);
mapObject.addAnnotation(annotations[1]);
mapObject.addAnnotation(annotations[2]);
mapObject.addAnnotation(annotations[3]);
self.add(mapObject);
self.add(selectAnnotations);
var thisObj = this;
selectAnnotations.addEventListener('click', function(e) {
mapObject.selectAnnotation(annotations[2], true);
});
{noformat}
Comments
JSON Source
Pull pending https://github.com/appcelerator/titanium_mobile/pull/2683
Verified fixed with: Titanium Studio, build: 2.1.1.201207271312 Titanium SDK, build: 2.2.0.v20120810080115 Device: LG VS910 4G (2.3.6)
Reopen to add backport fix version
Backport PR https://github.com/appcelerator/titanium_mobile/pull/2727 merged.
Reopening to update labels