PopupInfo on FeatureLayer

2223
2
03-07-2012 02:07 AM
by Anonymous User
Not applicable
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
0 Kudos
2 Replies
SimonKlein
Occasional Contributor
hi
I think you need the map context to create a new PopupView object.
0 Kudos
Yunus_SupriadiWijaya
New Contributor III
have you solve the problem?

could you share? that would be appreciated

Thanks
0 Kudos