Select to view content in your preferred language

SDK 100.1 Show the map legend

1624
4
Jump to solution
10-25-2017 09:19 AM
DavidHoxeng
Emerging Contributor

First let me say that this community is awesome for us new arcgis users!

I have been able to pull the map in and everything is working fantastic, except that I am not able to figure out how to display the legend for a map.  This is my last item needed for my project.  I am pulling the map in via portal id.

Any help would be greatly appreciated!

Thanks!

0 Kudos
1 Solution

Accepted Solutions
AlexanderNohe1
Honored Contributor

I don't believe that there is a Legend view built into the API, but what you can do is for each layer in the map, call Layer| arcgis-android fetchLegendInfoAsync and when it is returned, build the legend from the information provided into any view you wish.

I hope this helps!

View solution in original post

4 Replies
AlexanderNohe1
Honored Contributor

I don't believe that there is a Legend view built into the API, but what you can do is for each layer in the map, call Layer| arcgis-android fetchLegendInfoAsync and when it is returned, build the legend from the information provided into any view you wish.

I hope this helps!

DavidHoxeng
Emerging Contributor

Thank you for the response!  So for the layers, would these be the operational layers for the map (ArcGISMap.getOperationalLayers())?

0 Kudos
AlexanderNohe1
Honored Contributor

Yes

ShellyGill1
Esri Contributor

To futher Alexanders reply above, there's a great example of using this method to build a TOC in the Offline Mapbook example app. The app is described here - Offline Mapbook for Android | ArcGIS for Developers  - this topic also includes a link to the source code on GitHub so you can use this as a starting point if this helps.