ebenekeesri-southafrica-esridist

PopupInfo on FeatureLayer

Discussion created by ebenekeesri-southafrica-esridist Employee on Mar 7, 2012
Latest reply on Sep 6, 2013 by ysw.wijaya
Hi,

I am trying to build up a popupinfo to use on a featurelayer. However when I try and use the popupinfo I get an exception saying it is not yet initialized. This happens when calling     
PopupInfo popupInfo = fLayer.getPopUpInfo();
PopupView popupView = new PopupView(popupContainer.getContext(), popupInfo, g);


What am I doing wrong? Here is the code I use to build up the popupinfo:
fLayer = new ArcGISFeatureLayer(queryUrl, ArcGISFeatureLayer.MODE.ONDEMAND);

  Map<Integer, PopupInfo> newMap = new HashMap<Integer, PopupInfo>();

  PopupInfo pInfo = new PopupInfo();
  pInfo.setDescription("South African Post Offices");
  pInfo.setTitle("Post Offices");
  pInfo.setMaxScale(500000);
  pInfo.setMinScale(0);
  pInfo.setMediaInfos(new PopupMediaInfo[0]);
  pInfo.setShowAttachments(false);

  PopupFieldInfo popupFields[] = new PopupFieldInfo[3];

  //_name
  PopupFieldInfo nameInfo = new PopupFieldInfo();
  nameInfo.setFieldName("_name");
  nameInfo.setLabel("Name");
  popupFields[0] = (nameInfo);

  //suburb_are
  PopupFieldInfo suburbInfo = new PopupFieldInfo();
  suburbInfo.setFieldName("suburb_are");
  suburbInfo.setLabel("Suburb");
  popupFields[1] = (suburbInfo);

  //street_add
  PopupFieldInfo streetInfo = new PopupFieldInfo();
  streetInfo.setFieldName("street_add");
  streetInfo.setLabel("Street Address");
  popupFields[2] = (streetInfo);

  pInfo.setFieldInfos(popupFields);

  newMap.put(0, pInfo);

  fLayer.setPopUpInfos(newMap);

  mMapView.addLayer(fLayer);


Help would be appreciated!!

Thanks

Ed

Outcomes