ClassCastException when getting graphic attributes

Discussion created by mggl on Feb 8, 2012
Latest reply on Feb 15, 2012 by swatikch
I want to add a graphic on the map with some attributes. I put the graphic on the map with the following code                 

Point somePoint = new Point(someXValue, someYValue);
Map<String, Object> graphicAttributes = new HashMap<String, Object>();
graphicAttributes.put("location", somePoint);
Graphic graphic = new Graphic(someGeometry, someSymbol, graphicAttributes,null);

At another point in the code, I want to get the attributes of the graphic with the following code

Map<String, Object> clickedGraphicAttributes = clickedGraphic.getAttributes();

if (graphicAttributes.containsKey("location"))
    Log.d(logTag, "yes, a value with this key exists");      // this is printed on the logcat

Object attributeValue = graphicAttributes.get("location");
Log.d(logTag, "class: " + attributeValue.getClass().getSimpleName());   // this prints String

The attribute with the key "location" is type of String altough I put an object with a type of Point. Therefore, when I want to cast attributeValue to Point I get an exception. I cannot find a reason why this happens.