Can not init the MapView from the given WebMap

3656
7
Jump to solution
04-10-2012 01:34 AM
SimonKlein
Occasional Contributor
I upgraded my project to 1.1 and now i can not create a MapView with just the URL of my WebMap.
 mMapView = new MapView(this, bundle.getString("MAPURL"), "", "");

I tried it also with null instead "" for user and pwd. This is a little confusing too, becaus in the javadoc it says null and in the samples you use "" (PopupInWebMapForView).
If I use my WebMap in the PopupInWebMapForView example it does not work. But it loads fine if I use the arcgis.com version of my WebMap.

I get the following logcat: [ATTACH=CONFIG]13368[/ATTACH]

edit: To make it more clear: I have a WebMap exported from arcgis.com on my own server (no portal stuff).
It also seems I can not use arcgis.com maps in my main project now
 No implementation found for native Lcom/esri/android/map/Layer;.nativeSetName (JLjava/lang/String;)V
0 Kudos
1 Solution

Accepted Solutions
SimonKlein
Occasional Contributor
parser.nextToken(); before creating the webmap does the trick!

View solution in original post

0 Kudos
7 Replies
SimonKlein
Occasional Contributor
So do we need a ArcGIS Portal Service or arcgis.com now to be able to show our own webmaps?
I just want to give the URL of my Webmap to a MapView that is on our Mobile Server!

If I try to create a WebMap Object i get a 404 Not Found Exception. On 1.0.1 and the mobile javascript version everything works fine.
0 Kudos
SimonKlein
Occasional Contributor
When i want to create a MapView with
mMapView = new MapView(this, "http://www.arcgis.com/home/item.html?id=7a052def7a254f46b53c10f9ae594653", "", "");

I get the following error (it's the same if I use null instead of "":
04-12 12:05:51.310: W/dalvikvm(10149): No implementation found for native Lcom/esri/android/map/Layer;.nativeSetName (JLjava/lang/String;)V


If i try to create a MapView with one of the WebMaps on our ArcGIS mobile server I get this
04-12 12:27:37.530: E/ArcGIS(10365): Can not init the MapView from the given WebMap

(the rest of the logcat can be found in the first post)

If I try to create WebMap instance with one of our WebMaps from the ArcGIS mobile server I get an 404 Not Found EsriServiceException.

My project is updated from Version 1.0.1 to 1.1.. Loading the WebMaps in the ArcGIS Android App works fine, so there must be a way I guess.


I could really use some help on this please!
0 Kudos
SimonKlein
Occasional Contributor
Ok i could at least resolve the second error with manually deliting the arm lib files and then readding the new ones with "convert to ArcGIS Android Project" from the ArcGIS Tools.
0 Kudos
SimonKlein
Occasional Contributor
I could really use some help right now!

I tried to create a WebMap object with a JsonParser, but it seems I am missing something. I tried creating the parser with an URL or with JSON as String.
It just jumps over the return statement and gets me nothing.
String str= getJSONQueryAsString(params[0]);    
    JsonParser parser = h.createJsonParser( str);
    return WebMap.newInstance(parser,  new Envelope(0, 0, 0, 0), SpatialReference.create(31255));


So basically I want to add a WebMap to my MapView not from ArcGIS.com or any other Portal. It works in the ArcGIS Android App, so there is a way.
0 Kudos
SimonKlein
Occasional Contributor
parser.nextToken(); before creating the webmap does the trick!
0 Kudos
JohnAllen
New Contributor III
simra,

I'm trying to do the same thing, but I'm a little confused. Can you post your final code for making it work?

Thanks,
0 Kudos
SimonKlein
Occasional Contributor
I have to check if there is something better in the new SDK but I did it like this:

......JsonFactory h = new JsonFactory();

JsonParser parser = h.createJsonParser(webMapString);
    // this is needed to get a valid jsonparser
    parser.nextToken();
    // get a new WebMap instance
    return WebMap.newInstance(parser, null,
      SpatialReference.create(DEFAULT_SPACIAL_REFERENCE));.........

0 Kudos