AnsweredAssumed Answered

Android SDK(10.2.8) renderer doesn't work

Question asked by eriklimaimg on Jun 2, 2017
Latest reply on Jun 9, 2017 by ANohe-esristaff

Hi, people.

 

I am having a problem with the renderer from Android SDK when the map is local.

I am using the 10.2.8 version.


The process is the same to both online and offline mode, but on online mode it works and offline(local map) doesn't.

 

The code to define the renderer is:

 

    private UniqueValueRenderer getNotGeometryRenderer() {
        // Create the line symbols to outline
        final SimpleLineSymbol notGeometryLineSymbol = new SimpleLineSymbol(ContextCompat.getColor(this, R.color.transparent), 1, SimpleLineSymbol.STYLE.NULL);
        SimpleLineSymbol lineSymbol = new SimpleLineSymbol(ContextCompat.getColor(this, R.color.black), 1, SimpleLineSymbol.STYLE.SOLID);

        // Create the fill symbols
        final SimpleFillSymbol notGeometryFillSymbol = new SimpleFillSymbol(ContextCompat.getColor(this, R.color.transparent), SimpleFillSymbol.STYLE.SOLID);
        SimpleFillSymbol fillSymbol = new SimpleFillSymbol(ContextCompat.getColor(this, R.color.colorPrimary), SimpleFillSymbol.STYLE.SOLID);

        // Set the outline to fill symbols
        notGeometryFillSymbol.setOutline(notGeometryLineSymbol);
        fillSymbol.setOutline(lineSymbol);

        // Create the values to set up the renderer
        List<UniqueValue> values = new ArrayList<UniqueValue>() {{
            add(new UniqueValue() {{
                setValue(new Object[]{"S"});
                setSymbol(notGeometryFillSymbol);
            }});
        }};

        // Create and set up the renderer
        UniqueValueRenderer renderer = new UniqueValueRenderer();
        renderer.setField1("SEMGEOMETRIA");
        renderer.setUniqueValueInfos(values);
        renderer.setDefaultSymbol(fillSymbol);

        return renderer;
    }

 

To use the renderer I did:

 

    private void updatePlotLayerRenderer(Layer layer) {
        layer.setVisible(false);
        UniqueValueRenderer renderer = getNotGeometryRenderer();

        if (layer instanceof ArcGISFeatureLayer) {
            ArcGISFeatureLayer arcGISFeatureLayer = (ArcGISFeatureLayer) layer;
            arcGISFeatureLayer.setRenderer(renderer);
            arcGISFeatureLayer.refresh();
        } else if (layer instanceof FeatureLayer) {
            FeatureLayer featureLayer = (FeatureLayer) layer;
            featureLayer.setRenderer(renderer);
            map.refreshDrawableState();
        }

        layer.setVisible(true);
    }

 

So I call the updatePlotLayerRenderer method after the local map has been loaded.
Has anyone had this problem? Can help me?

 

Thanks!

Outcomes