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!
What is the exception that is being thrown?
Hi, Alexander!
Thanks for your answer!
There arent't exception.. just dont't show the simbology that I definned.
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?