IllegalArgumentException when trying to get the extent of the map

1115
1
07-29-2012 11:04 PM
_lkerArg_n
Emerging Contributor
When I try to get the extent of the map in onPause method with the code below,

try {
    Envelope extentEnvelope = new Envelope();
    Polygon extent = mapView.getExtent();
    extent.queryEnvelope(extentEnvelope);
} catch (Exception exception) {
    Log.e(logtag + ":saveMapExtent", "Map extent could not be saved!", exception);
}


I get IllegalArgumentException at the line:
Polygon extent = mapView.getExtent();
Here is the stack trace:

07-30 09:53:53.310: E/MapPage:saveMapExtent(5920): java.lang.IllegalArgumentException
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at com.esri.core.geometry.v.a(Unknown Source)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at com.esri.core.geometry.MultiPath.startPath(Unknown Source)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at com.esri.android.map.MapSurface.h(Unknown Source)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at com.esri.android.map.MapView.getExtent(Unknown Source)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at com.anelarge.todes.view.page.map.MapPage.saveMapExtent(MapPage.java:145)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at com.anelarge.todes.view.page.map.MapPage.onPause(MapPage.java:157)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at android.app.Activity.performPause(Activity.java:3877)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1191)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1686)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2836)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at android.app.ActivityThread.access$1600(ActivityThread.java:117)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at android.os.Looper.loop(Looper.java:130)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at android.app.ActivityThread.main(ActivityThread.java:3691)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at java.lang.reflect.Method.invokeNative(Native Method)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at java.lang.reflect.Method.invoke(Method.java:507)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
07-30 09:53:53.310: E/MapPage:saveMapExtent(5920):  at dalvik.system.NativeStart.main(Native Method)


I could not find a reason.
0 Kudos
1 Reply
deleted-user-ATjHIWsdQYmT
Deactivated User
Is the map initialized?  i.e.: do you have an extent to get?
0 Kudos