I’m developing an Android app using the ArcGIS SDK in Kotlin, specifically with com.arcgismaps.mapping.view.MapView, and I need to implement a ScaleBar that accurately displays the map scale and updates automatically with map zoom and position. I attempted to integrate the ScaleBar component using arcgis-runtime-toolkit-android, which does include a ScaleBar. However, I encountered compatibility issues because my map is implemented with the Kotlin SDK, arcgis-maps-sdk-kotlin-toolkit.
When trying to add the ScaleBar with the following code:
with(scalebar) {
alignment = Scalebar.Alignment.CENTER
addToMapView(mapView)
}
I get this error:
Required: com.esri.arcgisruntime.mapping.view.MapView
Found: com.arcgismaps.mapping.view.MapView?
It seems the SDK differences (Java vs. Kotlin) are causing this incompatibility.
My questions are:
- Is there a recommended way to implement a ScaleBar with com.arcgismaps.mapping.view.MapView in the Kotlin SDK?
- Does anyone know if there are plans to integrate the ScaleBar in the Kotlin SDK? If so, is there an estimated timeline?
As an alternative, I am considering creating a custom implementation to calculate and display the scale in a TextView, but having a native ScaleBar that integrates and updates automatically would be ideal.
I’d appreciate any suggestions or information on the future development of this functionality.
Thank you in advance!