Hello,
I tried to load a MapView using a WebMap. The WebMap is loaded from a json downloaded by Collector. This is my code:
First, I load the JsonParser that load the webmap.json
JsonFactory factory = new JsonFactory();
JsonParser parser = factory.createJsonParser(new FileInputStream(Constants.JSON_WEBMAP_PATH));
then I get an Evelop (called "extent") and a SpatialReference (called "sp").
Whit this values, load the webmap
webMap = WebMap.newInstance(parser, extent, sp);
and then, load the map
map = new MapView(MyActivity.this, webMap, null, null);
After this, I got this two errors:
11-27 13:00:12.460 5388-5678/com.esri.android.test.esrimasktest E/ArcGIS: Failed to check the service owning system URL
java.lang.NullPointerException
at com.esri.android.map.b$a.onWebMapLoadError(SourceFile:856)
at com.esri.android.map.a.a(SourceFile:77)
at com.esri.android.map.a.a(SourceFile:117)
at com.esri.android.map.b.loadServiceInfo(SourceFile:237)
at com.esri.android.map.Layer.loadServiceInfo(SourceFile:219)
at com.esri.android.map.ags.ArcGISFeatureLayer.initLayer(SourceFile:983)
at com.esri.android.map.Layer$2.run(SourceFile:253)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
11-27 13:00:12.460 5388-5678/com.esri.android.test.esrimasktest E/ArcGIS: Failed to initialize the ArcGISFeatureLayer.
java.lang.Exception: Failed to retrieve layer info.
at com.esri.android.map.ags.ArcGISFeatureLayer.initLayer(SourceFile:987)
at com.esri.android.map.Layer$2.run(SourceFile:253)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Any ideas to resolve? Thanks to all!
Solved! Go to Solution.
To load a MapView from a webmap, use one of the constructors on MapView which takes a URL to the webmap:
https://developers.arcgis.com/android/api-reference/reference/com/esri/android/map/MapView.html#MapV..., java.lang.String, java.lang.String, java.lang.String)
To load a MapView from a webmap, use one of the constructors on MapView which takes a URL to the webmap:
https://developers.arcgis.com/android/api-reference/reference/com/esri/android/map/MapView.html#MapV..., java.lang.String, java.lang.String, java.lang.String)