dictionary - android show multi point on esri map -


i new developer in arcgis environment , i'm android developer. training followed arcgis tutorials. want add multi point on map, when try, last point appears on map.
need solve it.

here current code:

 mapview mmapview;   graphicslayer graphicslayer = new graphicslayer();     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_hello_map);         mmapview = (mapview) findviewbyid(r.id.map);         mmapview.addlayer(graphicslayer);          simplemarkersymbol sms = new simplemarkersymbol(color.red,10, simplemarkersymbol.style.circle);          multipoint multipoint =  new multipoint();         multipoint.add(-5.2769,6.8169);         multipoint.add(-3.0195,8.7057);         multipoint.add(-0.0195,9.7057);           int len = multipoint.getpointcount();         graphic[] graphics = new graphic[len];         for(int = 0; i<len; i++){             point pt = multipoint.getpoint(i);             graphics[i] = new graphic(pt,sms);            graphicslayer.addgraphic(graphics[i]);         }         //graphicslayer.addgraphics(graphics);         toast.maketext(getapplicationcontext(),"count "+graphicslayer.getnumberofgraphics(),toast.length_long).show();      } 

your code works fine me using arcgis runtime 10.2.4, have zoom in far see 3 distinct points because coordinates in meters if you're using 1 of standard arcgis basemaps. maybe that's problem. if values supposed longitude , latitude instead, have project them, , can after mapview has been initialized, can using onstatuschangedlistener. try this:

@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_hello_map);     mmapview = (mapview) findviewbyid(r.id.map);     mmapview.addlayer(graphicslayer);      final simplemarkersymbol sms = new simplemarkersymbol(             color.red, 10, simplemarkersymbol.style.circle);      final multipoint multipoint =  new multipoint();     multipoint.add(-5.2769,6.8169);     multipoint.add(-3.0195,8.7057);     multipoint.add(-0.0195,9.7057);      final int len = multipoint.getpointcount();     final graphic[] graphics = new graphic[len];     mmapview.setonstatuschangedlistener(new onstatuschangedlistener() {         public void onstatuschanged(object source, status status) {             if (status.initialized.equals(status)) {                 (int = 0; < len; i++){                     point pt = multipoint.getpoint(i);                     pt = (point) geometryengine.project(                             pt.getx(),                             pt.gety(),                             mmapview.getspatialreference());                     graphics[i] = new graphic(pt,sms);                     graphicslayer.addgraphic(graphics[i]);                 }             }         }     });      //graphicslayer.addgraphics(graphics);     toast.maketext(getapplicationcontext(),"count "+graphicslayer.getnumberofgraphics(),toast.length_long).show();  } 

fyi if prefer, can create single graphic multipoint geometry, instead of 3 graphics creating point geometries now. once again, need project multipoint map's spatial reference.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -