cbdonohue_bah

Trouble with graphic attributes 10.1.1

Discussion created by cbdonohue_bah on Jan 18, 2013
If I put an object into a attribute map for a graphic and then pull it back out it is converted to a String type.
  Map<String, Object> attrMap = new HashMap<String, Object>();
  attrMap.put("location_update", loc); //loc is of type LocationUpdate
  Object object = attrMap.get("location_update");
  if(object instanceof LocationUpdate){
                        //this happens, everything seems ok
   Log.d("casting", "Starts as a string object");
  } 
  locLayer.updateGraphic(locGraphicId, attrMap);
  object = locLayer.getGraphic(locGraphicId).getAttributeValue("location_update");
  if(object instanceof String){
                        //this executes, why is it a string now?
   Log.d("casting", "Now a String object");
  }
  if(object instanceof LocationUpdate){
                        //never gets here!
   Log.d("casting", "Still a LocationUpdate object");
  }

Outcomes