AnsweredAssumed Answered

a bug  in  arcgis android sdk api ----- Graphic.fromJson(parser)

Question asked by xiasg on Oct 21, 2014

i get myjson string  use the mothed   Graphic.toJson(graphic) and it's about this

     {"attributes":{"id":1,"name":"aa"},"geometry":{"x":121.14829488816405,"y":31.278801530446056,"spatialReference":{"wkid":4326}}}

 

but when i use the method Graphic.fromJson(parser), they return null;

he is the code :

JsonFactory localJsonFactory = new MappingJsonFactory();

String graphicStr ="{\"attributes\":{\"id\":1,\"name\":\"aa\"},\"geometry\":{\"x\":121.14829488816405,\"y\":31.278801530446056,\"spatialReference\":{\"wkid\":4326}}}";

JsonParser parser = localJsonFactory.createJsonParser(graphicStr);

Graphic g = Graphic.fromJson(parser);

parser.close();

graphicsLayer.addGraphic(g);

 

when debug  g is null.

Outcomes