Select to view content in your preferred language

set feature layer with graphics

4010
2
04-06-2016 03:24 PM
JoseVelasquez2
Deactivated User

hi,

I'm trying to fill a feature layer with graphics but have the problem that when using the FeatureLayer(graphics[]) Instruction does not add the graphics to the feature layer showing the following Error "method invocation may produce java.lang.nullpointerexception,  I tried assigning a single value to the list level code does not generate any error and graphics list is filled correctly, or have any idea how that can fill a feature layer with a list of graphics?

I attached my code

MapView mMapView;

ArcGISFeatureLayer featurelayerpoints;

FeatureSet variablefeatureset = null;

Graphic [] graficos = new Graphic[listcount];

for(int i = 0;i< listcount;i++){

Point wgspoint = new Point(routesinfolist.Longitude,routesinfolist.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.IDOrder), "IDOrder");

graficos = new Graphic(mapPoint, new PictureMarkerSymbol(getResources().getDrawable(R.drawable.circler)), attributes, i);

}

variablefeatureset.setGraphics(graficos);

featurelayerpoints = new ArcGISFeatureLayer(null, variablefeatureset, null);

mMapView.addLayer(featurelayerpoints,5);

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Jose,

  What are you developing for ArcGIS Runtime or is this .Net SDK or what? You have this question in the general GeoNet community help and there are many more appropriate places for this question if I knew what you are programming against.

0 Kudos
JoseVelasquez2
Deactivated User

i'm developing in android

0 Kudos