我试图用图形填充功能层,但有一个问题,即当使用FeatureLayer(graphics[])时,指令不会将图形添加到功能层。它显示了以下内容
Error "method invocation may produce java.lang.nullpointerexception
我尝试为列表级别代码指定一个值,但不会生成任何错误,图形列表已正确填充,或者知道如何使用图形列表填充要素层?
我附上了我的代码
MapView mMapView;
ArcGISFeatureLayer featurelayerpoints;
FeatureSet variablefeatureset = null;
Graphic[] graficos = new Graphic[listcount];
for (int i = 0; i < listcount; i++) {
Point wgspoint = new Point(routesinfolist[i].Longitude, routesinfolist[i].Latitude);
Point mapPoint = (Point) GeometryEngine.project(wgspoint, SpatialReference.create(4326),
mMapView.getSpatialReference());
Unit mapUnit = mMapView.getSpatialReference().getUnit();
double zoomWidth = Unit.convertUnits(SEARCH_RADIUS, Unit.create(LinearUnit.Code.MILE_US), mapUnit);
attributes.put(String.valueOf(routesinfolist[i].IDOrder), "IDOrder");
graficos[i] = new Graphic(mapPoint, new PictureMarkerSymbol(getResources().getDrawable(R.drawable.circler)), attributes, i);
}
variablefeatureset.setGraphics(graficos);
featurelayerpoints = new ArcGISFeatureLayer(null, variablefeatureset, null);
mMapView.addLayer(featurelayerpoints, 1);