我使用GWT技术为我的应用程序使用谷歌地图,问题是在地图中获得标记,在开发模式中没有任何异常或警告。但是,当我在生产模式下运行它时,会得到未捕获(TypeError):异常:无法调用null的方法'Id',并且当我单击"确定"按钮时,映射加载没有标记。有人能帮助解决(跟踪)这个异常吗。
final LatLng mLatLng = LatLng.create(24.675, 46.708);
myOptions = MapOptions.create();
myOptions.setZoom(9);
myOptions.setCenter(mLatLng);
myOptions.setMapTypeId(MapTypeId.ROADMAP);
myOptions.setMapTypeControl(true);
Timer load = new Timer() {
@Override
public void run() {
fullTrackingMap = GoogleMap.create(mapVp.getElement(),myOptions);
/* Service call here */
filterMap(hashMap); // hashmap<String, Marker>
}
};
load.schedule(1000);
private void filterMap(SortedMap<String, Marker> hashMap) {
if (hashMap.get(e.getKey()) != null) {
Marker marker = hashMap.get(e.getKey());
if (e.getValue().equalsIgnoreCase("false")) {
marker.setMap((GoogleMap) null);
} else {
marker.setMap(fullTrackingMap);
}
markers.add(marker);
}
}
我正在从服务器端获取hashmap的值,而不是在上面的代码片段中。
检查对象的初始化情况。生产模式中的问题主要是因为对象初始化。