Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4453] Android - Crash when clicked on a mapview annotation without pincolor property

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionDuplicate
Resolution Date2012-04-30T17:22:31.000+0000
Affected Version/sRelease 1.7.0, Release 1.6.2, Release 1.7.1, Release 1.7.3
Fix Version/sn/a
ComponentsAndroid
Labelsannotation, mapview
ReporterPedro Enrique
AssigneeJosh Roesslein
Created2011-06-17T17:47:54.000+0000
Updated2017-03-21T22:39:48.000+0000

Description

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.

Attachments

FileDateSize
nullPointerException.txt2012-01-06T10:23:20.000+00007807

Comments

  1. pyephyo han 2011-08-09

    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
  2. Tony Lukasavage 2011-10-14

    This still exists in the latest 1.7.3
  3. Wilson Luu 2012-01-06

    Bug persists on 1.8.0.1. I get a Java NullPointerException in the console. See attachment.
  4. Dustin Hyde 2012-01-19

    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
  5. Josh Roesslein 2012-04-30

    This is a duplicate of TIMOB-8675 which has been resolved.
  6. Lee Morris 2017-03-21

    Closing ticket as duplicate.

JSON Source