在谷歌地图上移动位置时,NativeScript应用程序会中断

时间:2018-06-15 16:32:01

标签: android google-maps typescript nativescript angular2-nativescript

我使用Nativescript谷歌地图插件在我的移动应用程序中添加了谷歌地图。这是我的HTML

<MapView #mapView [latitude]="latitude" [longitude]="longitude" [zoom]="zoom" [minZoom]="minZoom" [maxZoom]="maxZoom" [bearing]="bearing" [tilt]="tilt" i-padding="50,50,50,50" [padding]="padding" (mapReady)="onMapReady($event)" (markerInfoWindowTapped)="onMarkerWindowTapped($event)" (cameraChanged)="onCameraChanged($event)" row="1" col="0" colspan="2"> </MapView>

我有一个下拉列表,其下拉列表显示地图上的多个标记。当我在下拉列表中更改值时,我想更改相机位置。以下是我处理下拉列表更改事件的方法

onchange(args: SelectedIndexChangedEventData) {

let event = this.events.filter(event => event._id === this.itemSource.getValue(args.newIndex));

console.dir(event);
//this.latitude =  event[0].locationInfo.coordinates[0];
//this.longitude = event[0].locationInfo.coordinates[1];

}

如果我取消注释最后2行并且相机位置发生变化,则此代码会成功执行。但是,在相机位置改变后,我得到低于未知的异常,我无法调试

System.err: java.lang.reflect.InvocationTargetException System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.tns.NativeScriptUncaughtExceptionHandler.uncaughtException(NativeScriptUncaughtExceptionHandler.java:55) System.err: at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068) System.err: at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063) System.err: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.PendingIntent.send(android.content.Context, int, android.content.Intent)' on a null object reference System.err: at com.tns.ErrorReport.startPendingErrorActivity(ErrorReport.java:156) System.err: at com.tns.ErrorReport.startActivity(ErrorReport.java:133) System.err: ... 4 more System.err: java.lang.reflect.InvocationTargetException System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.tns.NativeScriptUncaughtExceptionHandler.uncaughtException(NativeScriptUncaughtExceptionHandler.java:55) System.err: at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068) System.err: at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063) System.err: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.PendingIntent.send(android.content.Context, int, android.content.Intent)' on a null object reference System.err: at com.tns.ErrorReport.startPendingErrorActivity(ErrorReport.java:156) System.err: at com.tns.ErrorReport.startActivity(ErrorReport.java:133) System.err: ... 4 more

有人至少可以提供一些可能导致相同原因的提示吗?请注意,如果我在更改下拉列表时注释更改纬度/经度的行,则一切正常。

0 个答案:

没有答案