How do I get the Label String of a Feature?

07-04-2018 10:58 AM
New Contributor

Is there a way to get the String a Feature would have as a Label? I saw you have the LabelingInfo and the LabelDefinition classes but I can't find a way to get the String. As far as I saw you can only get the LabelExpression but it would be a very tedious task to parse this into the right String.

I am using the latest ArcGis Runtime version 100.2.1

I hope someone can help me. Thanks in advance.

Tags (2)
0 Kudos
2 Replies
Regular Contributor II

Hi Daniel.

String ldString = featureLayer.getLabelDefinitions().get(0).toJson();

if 'featureLayer' has at least 1 labelDefinition, calling toJson() will give you the serialized representation of that. In that string, you'll see the "Expression" value of where the text for that label comes from. 

Is this what you're looking for?

Also see Show Labels on Layer—ArcGIS Runtime SDK for Android | ArcGIS for Developers .

0 Kudos
New Contributor

No it's not really what I am looking for. I don't want the expression of where the text for the label comes from. I want the final text of the label. If you compare it to a renderer there you can get the symbol of each feature and I want the same but for the labels.

Am 9. Juli 2018, 06:57, um 06:57, Eric Bader <> schrieb:

>Eric Bader


>replied to the discussion

>"Re: How do I get the Label String of a Feature?"

>To view the discussion, visit:



0 Kudos