如何使用图形要素集设置要素层Android Arcgis

How to set feature layer with graphic feature set Android Arcgis

我正在尝试用图形填充要素层,但遇到问题,即在使用 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);

目前,您的 FeatureSet variablefeatureset 设置为 null。您需要使用提供的构造函数对其进行初始化。 [docs]

FeatureSet variablefeatureset = new FeatureSet();