// create a map with the BasemapStyle topographic
val map = ArcGISMap(BasemapStyle.ArcGISImagery)
// Create an ArcGIS Map Image Layer for the ESRI map server layer
val mapServiceUrl = "https://.../MapServer"
val mapImageLayer = ArcGISMapImageLayer(mapServiceUrl)
// load sublayers of mapServiceUrl
val hospitalSublayer = ArcGISMapImageSublayer(1).apply {name = "Hospital"}
.......list of 35 sublayers
// create a group layer from scratch by adding the Sublayers as children
val mapSublayers = GroupLayer().apply {
name ="Group Base Map"
addAll(arrayListOf(, hospitalSublayer, ...35 sublayers listed out))
}
basemap.operationalLayers.add(mapImageLayer)
basemap.operationalLayers.add(mapSublayers)
I'm getting an error at "name ='Group Base Map'" where Android Studio throws "Val cannot be reassigned." Android Studio highlights "name" in the list block of 35 sub-layers where I load sublayers of mapServiceUrl.