[TIMOB-12837] Mapsv2 Module: App crash when attempting to use addAnnotations method.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-02-25T21:57:35.000+0000 |
Affected Version/s | Release 3.0.2 |
Fix Version/s | Release 3.1.0, 2013 Sprint 05 API, 2013 Sprint 05 |
Components | Android |
Labels | api, qe-mapv2 |
Reporter | Eric Merriman |
Assignee | Hieu Pham |
Created | 2013-02-24T07:19:42.000+0000 |
Updated | 2014-06-19T12:43:10.000+0000 |
Description
When trying to pass in an array of annotations to an existing map using the "addAnnotations" method, the app crashes.
var win = Ti.UI.createWindow({fullscreen: false});
var MapModule = require('ti.map');
var map = MapModule.createView({
userLocation: true,
mapType: MapModule.NORMAL_TYPE,
animate: true,
//annotations: [anno, anno2, anno4],
region: {latitude: -33.87365, longitude: 151.20689, latitudeDelta: 0.1, longitudeDelta: 0.1 } //Sydney
});
var anno = MapModule.createAnnotation({latitude: -33.87365, image: 'map_pin.png', longitude: 151.20689, title: "Sydney", subtitle: "Sydney is quite chill", draggable: true});
var anno2 = MapModule.createAnnotation({latitude: -33.86365, pincolor: MapModule.ANNOTATION_BLUE, longitude: 151.21689, title: "Anno2", subtitle: "Blue Draggable", draggable: true});
var anno3 = MapModule.createAnnotation({latitude: -33.85365, longitude: 151.20689, title: "Anno3", subtitle: "Not Draggable", draggable: false});
var anno4 = MapModule.createAnnotation({latitude: -33.86365, longitude: 151.22689, title: "Anno4", subtitle: "Draggable", draggable: true});
var myAnnotations=[];
myAnnotations.push(MapModule.createAnnotation({
latitude: 37.391232,
longitude: -122.050923,
pincolor: MapModule.ANNOTATION_GREEN
}));
myAnnotations.push(MapModule.createAnnotation({
latitude: -33.86365,
longitude: 151.22689,
title: "Anno4",
subtitle: "Draggable",
draggable: true
}));
win.add(map);
map.addAnnotations(myAnnotations);
win.open();
Steps to reproduce:
1) Use sample code above in your pre-configured app with Google map API v2 key
2) Run the app
Result:
App crash with adb log cat:
W/dalvikvm(29704): threadid=1: thread exiting with uncaught exception (group=0x41450930)
E/TiApplication(29704): (main) [4298,4298] Sending event: exception on thread: main msg:java.lang.ClassCastException: java.lang.Object[] cannot be cast to ti.map.AnnotationProxy[]; Titanium 3.0.2,2013/02/15 19:02,5a77fe7
E/TiApplication(29704): java.lang.ClassCastException: java.lang.Object[] cannot be cast to ti.map.AnnotationProxy[]
E/TiApplication(29704): at ti.map.ViewProxy.handleMessage(ViewProxy.java:86)
E/TiApplication(29704): at android.os.Handler.dispatchMessage(Handler.java:95)
E/TiApplication(29704): at android.os.Looper.loop(Looper.java:137)
E/TiApplication(29704): at android.app.ActivityThread.main(ActivityThread.java:5039)
E/TiApplication(29704): at java.lang.reflect.Method.invokeNative(Native Method)
E/TiApplication(29704): at java.lang.reflect.Method.invoke(Method.java:511)
E/TiApplication(29704): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/TiApplication(29704): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/TiApplication(29704): at dalvik.system.NativeStart.main(Native Method)
D/AudioStreamOutALSA( 165): mHandle->useCase: HiFi Lowlatency
D/ALSAModule( 165): s_route: devices 0x2 in mode 0
D/ALSAModule( 165): switchDevice: device 2 mode:0
D/ALSAModule( 165): No valid input device: 0
D/ALSAModule( 165): switchDevice,rxDev:Speaker, txDev:(null), curRxDev:Speaker, curTxDev:None
D/alsa_ucm( 165): snd_use_case_set(): uc_mgr 0x40c25388 identifier _enadev value Speaker
D/ALSAModule( 165): switchDevice: curTxUCMDevivce None curRxDevDevice Speaker
D/alsa_ucm( 165): snd_use_case_set(): uc_mgr 0x40c25388 identifier _verb value HiFi Lowlatency
D/alsa_ucm( 165): Set mixer controls for Speaker enable 1
D/ACDB-LOADER( 165): ACDB -> send_afe_cal
D/alsa_ucm( 165): Set mixer controls for HiFi Lowlatency enable 1
D/ALSAModule( 165): Device value returned is hw:0,14
D/ALSAModule( 165): setHardwareParams: reqBuffSize 1024 channels 2 sampleRate 48000
D/ALSAModule( 165): setHardwareParams: buffer_size 2048, period_size 1024, period_cnt 2
E/AndroidRuntime(29704): FATAL EXCEPTION: main
E/AndroidRuntime(29704): java.lang.ClassCastException: java.lang.Object[] cannot be cast to ti.map.AnnotationProxy[]
E/AndroidRuntime(29704): at ti.map.ViewProxy.handleMessage(ViewProxy.java:86)
E/AndroidRuntime(29704): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(29704): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(29704): at android.app.ActivityThread.main(ActivityThread.java:5039)
E/AndroidRuntime(29704): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(29704): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(29704): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime(29704): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime(29704): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 581): Force finishing activity com.appcelerator.mapmod/.Mapv2moduletestActivity
D/overlay ( 162): FROM_STATE = OV_BYPASS_3_LAYER TO_STATE = OV_CLOSED
W/ActivityManager( 581): Activity pause timeout for ActivityRecord{41d06c00 u0 com.appcelerator.mapmod/.Mapv2moduletestActivity}
Expected:
Annotations added to map
PR: https://github.com/appcelerator/titanium_modules/pull/84
Verified small app crash fixed with commit 79ecd69911a94b0193d4dec21fc17ad17bfe8239. Closing.