Edit graphic properities at runtime?

827
3
05-08-2013 05:23 AM
ThomasBinu
New Contributor III
How can I edit the properties of a graphic at runtime , for example ,to change the attributes and geometry. I went through the api reference and there are no set methods for any property of a graphic.

Thanks,

Tom
0 Kudos
3 Replies
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
Here's how the API defines a Graphic:

Graphic objects are immutable, which means its state cannot change after construction. When a Graphic object is added to a GraphicsLayer via the GraphicsLayer#addGraphic(Graphic) method, this method returns a unique ID (UID) which you can then use to reference the added graphic for subsequent operations. Graphic objects are stateless so there is no guarantee that a feature in the GraphicsLayer exists after the request for the Graphic object is completed.

So, from that - I would say, no you cannot change attributes or geometry at runtime.
0 Kudos
ThomasBinu
New Contributor III
Here's how the API defines a Graphic:

Graphic objects are immutable, which means its state cannot change after construction. When a Graphic object is added to a GraphicsLayer via the GraphicsLayer#addGraphic(Graphic) method, this method returns a unique ID (UID) which you can then use to reference the added graphic for subsequent operations. Graphic objects are stateless so there is no guarantee that a feature in the GraphicsLayer exists after the request for the Graphic object is completed.

So, from that - I would say, no you cannot change attributes or geometry at runtime.


Thank you for the info andrew. However, I think the iOS version allows editing properties at runtime. Isn't the arcgis API structure designed the same way across both the platforms?
0 Kudos
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
I stand somewhat corrected... While you cannot update a graphic directly, it looks like you can update it's attribute(s) by referencing the graphics ID from the GraphicsLayer.   

Check out GraphicsLayer.updateGraphic(int id, Map<String, Object> attributes) in the API reference.
Updates the attributes of a graphic specified by id with an attribute map.





0 Kudos