AnsweredAssumed Answered

When is it not safe to call MapView.getScale() and MapView.GetVisibleArea()?

Question asked by Crittermap on Sep 21, 2018
Latest reply on Oct 12, 2018 by sgill-esristaff

We get some crash reports sometimes that we don't quite understand.

I understand that there are times when the MapView is not ready to return information like Scale and VisibleArea.

 

But how do I tell when it is safe? Crashing isn't very user friendly. 

 

Example 1:

com.esri.arcgisruntime.internal.jni.CoreMapView.nativeGetScale (SourceFile)
com.esri.arcgisruntime.internal.jni.CoreMapView.q (SourceFile:233)
com.esri.arcgisruntime.internal.h.b.o.m (SourceFile:224)
com.esri.arcgisruntime.mapping.view.MapView.getMapScale (SourceFile:295)
....HomeActivity.updateZoomLevelText (BCHomeActivity.java:687)
...HomeActivity.access$000 (BCHomeActivity.java:203)
...HomeActivity$1.mapScaleChanged (BCHomeActivity.java:366)
com.esri.arcgisruntime.internal.h.b.n$1.run (SourceFile:58)

 

 

Sure there are times when the scale can't be read. But I don't think one of those times should be when you just called us to tell us the scale changed. That seems like a time when we can get a scale and update the zoomlevel. But nope, it crashes. Not all the time, but some of the time. 

A bit ridiculous?

 

Is there some method available like boolean MapView isItSafetoAskforScale() ?

 

Because the only other alternative I can think of is to handle an exception every time we call MapView.getMapScale().

Or just let it crash. 

Outcomes