AnsweredAssumed Answered

queryTask sample

Question asked by mahshidfv on Feb 26, 2017
Latest reply on Feb 27, 2017 by mahshidfv

Hi,In querytask sample i have a problem.when i search a place it can found it but cant change color of feature.

i use 'ArcGISDynamicMapServiceLaye' 

for load map.and when search data change feature in this map.this is my code:

 

addText = false;
queryLayer = "http://192.168.10.1:6080/arcgis/rest/services/Babolsar/Babolsar/MapServer";

map = (MapView) findViewById(R.id.map);
ArcGISDynamicMapServiceLayer tms = new ArcGISDynamicMapServiceLayer("http://192.168.10.1:6080/arcgis/rest/services/Babolsar/Babolsar/MapServer");
map.addLayer(tms);

Options o = new Options();
o.mode = MODE.ONDEMAND;
o.outFields = new String[]{"OBJECTID"};
fLayer = new ArcGISFeatureLayer("http://192.168.10.1:6080/arcgis/rest/services/Babolsar/Babolsar/MapServer/10", o);

SimpleFillSymbol fiedldsSelectionSymbol = new SimpleFillSymbol(Color.MAGENTA);
fiedldsSelectionSymbol.setOutline(new SimpleLineSymbol(Color.YELLOW, 2));
fLayer.setSelectionSymbol(fiedldsSelectionSymbol);
map.addLayer(fLayer);



map.setOnStatusChangedListener(new OnStatusChangedListener() {

    private static final long serialVersionUID = 1L;

    @Override
    public void onStatusChanged(Object source, STATUS status) {

        if (source == map && status == STATUS.INITIALIZED) {

            graphicsLayer = new GraphicsLayer();
            SimpleRenderer sr = new SimpleRenderer(
                    new SimpleFillSymbol(Color.RED));
            graphicsLayer.setRenderer(sr);
            map.addLayer(graphicsLayer);

        }
    }
});




Outcomes