Hi, we use ArcGISMap in an AndroidView. When we recompose the composition so that the map is not rendered anymore and recompose again so that the map is displayed again, I get the common error "object already owned" for the wmts map we assign to the ArcGISMap. I understand that.
What I do to avoid that is to use the onRelease callback from the AndroidView to set the map to null.
onRelease = { view ->
// Required, if not set to null, map object will be marked
// as owned when retuning from zoom view
view.map = null
}
This works for the recomposition part. But when I finish() the Activity, I get the following error in 50% of my tests. This seems to me like the map may not be null.
java.lang.RuntimeException: Unable to destroy activity {de.bwi.kvib.mobile.dev/de.bwi.kvib.mobile.feature.pois.PoiComposeActivity}: java.lang.NullPointerException: Null pointer.
...
Caused by: java.lang.NullPointerException: Null pointer.
...
Caused by: com.arcgismaps.exceptions.ArcGISExceptionImpl: message=Null pointer., additionalMessage=object cannot be null., errorCode=1
Can you propose a solution to either avoid that NPE or unassign the map from the ArcGISMap?