The problem
If the annotation is clicked but it does not have a pincolor, the app crashes when clicked on it
Solution
Add a pincolor manually to the annotation
Code Sample
var W = {};
W.MapView = function(){
var win = Ti.UI.createWindow({
tabBarHidden:true,
fullscreen:false
});
var data = [];
data.push(
Ti.Map.createAnnotation({
latitude:40.892651,
longitude:-74.001920,
title:'title here',
subtitle:'sub title here'
// , pincolor:Titanium.Map.ANNOTATION_GREEN
})
);
var map = Ti.Map.createView({
region:{
latitude:40.892651,
longitude:-74.001920,
latitudeDelta:0.1,
longitudeDelta:0.1
},
annotations:data
});
win.addEventListener('open', function(){
win.add(map);
});
return win;
}
W.MapView().open();
To reproduce
1. Run the code provided in app.js as is. Click on the pin. It will crash.
2. Uncomment line 14 to give it a color. It will not crash.
Note that when
pincolor
is set to a supported color, as per the list in [TiMapView.java](
https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/map/src/ti/modules/titanium/map/TiMapView.java#L199), the app does not crash and the color renders correctly.
When
pincolor
is set to a non-supported color, such as "mycolor", the app also does not crash and the rendered color defaults to yellow.
I also have some issue but your solution is not working for me. If you don't mind, please take a look at here also http://developer.appcelerator.com/question/123964/map-crashes-when-clicking-twice-on-annotation-android
This still exists in the latest 1.7.3
Bug persists on 1.8.0.1. I get a Java NullPointerException in the console. See attachment.
Bug Still Valid. SDK: 1.9.0.v20120118184633, 1.8.0.1 Android: V8/Rhino Studio: 1.0.8 OS: Lion Devices Tested: Galaxy Nexus 4.0.2, Nexus S 2.3.6
This is a duplicate of TIMOB-8675 which has been resolved.
Closing ticket as duplicate.