Android SDK(10.2.8) renderer doesn't work

889
3
06-02-2017 07:51 AM
ErikLima
New Contributor III

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!

0 Kudos
3 Replies
AlexanderNohe1
Occasional Contributor III

What is the exception that is being thrown?

0 Kudos
ErikLima
New Contributor III

Hi, Alexander!

Thanks for your answer!

There arent't exception.. just dont't show the simbology that I definned.

0 Kudos
AlexanderNohe1
Occasional Contributor III

As a test, can you add a log statement to this block:

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

To ensure that, yes, this section is being called (This should be the offline feature).

As another test, additionally, can you try removing the FeatureLayer from the map and readding it after the renderer has been applied to the layer?

0 Kudos