Popup Custom Attribute Display and Popup.getDesciption()

639
1
04-29-2020 08:36 AM
by Anonymous User
Not applicable
I have a question regarding popups with custom attribute display and want to confirm the method I am using is solid given the scenario.  I have seen zero examples of how to do this properly in runtime, but maybe it is out there.  
OK so this is the scenario.  I have a Web Map setup for popups with custom attribute display that opens surveys in Survey123 with associated html when you click on a point feature to bring up the form...
I am able to get everything to work by creating a WebView and then using popup.getDescription() to get the html to populate.  My question is this.  Will this method always work when a Web Map has a Popup Custom Attribute Display?  I have seen zero documentation on how to do this in runtime samples, but I will say this method seems to work in all the web maps I have tested against.  For other folks benefit have included the code and an example of the associated html that is produced from getDescription().  I am using a dialog class as the form factor.
public class PopupDialog extends DialogFragment {
   private View currentView;
   @Override
   public void onCreate(Bundle savedBundleInstance) {
      super.onCreate(savedBundleInstance);
   }

   @Override
   public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle savedBundleInstance) {
      super.onCreateView(inflater, parent, savedBundleInstance);
      currentView = inflater.inflate(R.layout.popup_info, parent, false);
      LinearLayout rlFields = (LinearLayout)  currentView.findViewById(R.id.rlfields);
      Feature feature = activeSelectionData.getFeature();
      FeatureLayer featureLayer = (FeatureLayer) feature.getFeatureTable().getLayer();
      Popup popup = new Popup(feature,featureLayer.getPopupDefinition());
      String x  = popup.getDescription();
      WebView popupWV = (WebView) currentView.findViewById(R.id.webPopup);
      popupWV.loadDataWithBaseURL(null, "" + x + "", "text/html", "UTF-8", null);
      return currentView;
   }// oncreateView

}
<p>EvalStatus: {EvalStatus}<br />PlotID: {PlotID}</p><p><a href='arcgis-survey123://?itemID=0f42788e0f0e42cf8197e68218804266&amp;field:Office={Office}&amp;field:PlotID={PlotID}&amp;field:PlotKey={PlotKey}&amp;field:GapData={GapData}&amp;field:LineLength={LineLength}' rel='nofollow ugc' target='_blank'>Launch GAP Form</a>  </p><p><a href='arcgis-survey123://?itemID=bf08d953eb84460c93f7502d3a925a73&amp;field:Office={Office}&amp;field:PlotID={PlotID}&amp;field:PlotKey={PlotKey}&amp;field:interval={Interval}&amp;field:htinterval={HTInterval}&amp;field:showshape={ShrubShape}&amp;field:LineLength={LineLength}' rel='nofollow ugc' target='_blank'>Launch LPI Form</a></p><p><a href='arcgis-survey123://?itemID=15220f4f0d9f4f9c83fc32af5876eb72&amp;field:Office={Office}&amp;field:PlotID={PlotID}&amp;field:PlotKey={PlotKey}' rel='nofollow ugc' target='_blank'>Launch Plot Char Form</a></p><p><a href='arcgis-survey123://?itemID=c1dd6e815b7944afb688823972858fe6&amp;field:Office={Office}&amp;field:PlotID={PlotID}&amp;field:PlotKey={PlotKey}' rel='nofollow ugc' target='_blank'>Launch AIM Photos Form</a></p><p><a href='arcgis-survey123://?itemID=3c70d396d07e4836bc18c1d778847783&amp;field:Office={Office}&amp;field:PlotID={PlotID}&amp;field:PlotKey={PlotKey}&amp;field:DesignLat={DesignLatWGS}&amp;field:DesignLong={DesignLongWGS}' rel='nofollow ugc' target='_blank'>Launch Plot Observation Form</a></p><p><a href='arcgis-survey123://?itemID=952fcee9d5a546c996020e71f6816e62&amp;field:Office={Office}&amp;field:PlotID={PlotID}&amp;field:PlotKey={PlotKey}' rel='nofollow ugc' target='_blank'>Launch Soil Stability Form</a></p><p><a href='arcgis-survey123://?itemID=3edfdf845b0a4e0986f335458ad4cd4f&amp;field:Office={Office}&amp;field:PlotID={PlotID}&amp;field:PlotKey={PlotKey}' rel='nofollow ugc' target='_blank'>Launch Species Richness Form</a></p><p><a href='arcgis-survey123://?itemID=6506b0dd7cd7478eac534458a3388a6c&amp;field:Office={Office}&amp;field:PlotID={PlotID}&amp;field:PlotKey={PlotKey}' rel='nofollow ugc' target='_blank'>Launch Unknown Plants Form</a> </p><p><a href='arcgis-survey123://?itemID=a94561247cc1415d967e787f3eb8b966&amp;field:Office={Office}&amp;field:PlotID={PlotID}&amp;field:PlotKey={PlotKey}' rel='nofollow ugc' target='_blank'>Launch Known Errors Form</a></p><p><br />Change if needed</p><p>Moved?: {Moved}<br />Notes: {Notes} </p><p> <br />This section only works in a Browser<br /> <br />Completed Forms and Issues <br />Gap {relationships/3/objectid} <font color='#ff0000'> {expression/expr0}</font><br />LPI {relationships/5/objectid} <font color='#ff0000'>{expression/expr1}</font><br />Spec Rich {relationships/9/objectid} <font color='#ff0000'>{expression/expr2}</font><br />Soil Stab {relationships/8/objectid} <font color='#ff0000'>{expression/expr3}</font><br />Plot Ob {relationships/7/objectid}<font color='#ff0000'> {expression/expr4}</font><br />Plot Char {relationships/6/objectid}<font color='#ff0000'> {expression/expr5}</font><br />Photos {relationships/2/objectid} <font color='#ff0000'>{expression/expr6}</font><br />Unknown Plants<font color='#ff0000'> {relationships/10/objectid}</font> <br />Known Errors <font color='#ff0000'>{relationships/4/objectid}</font>  </p><p><br />Config </p><p>Gap Data: {GapData}<br />Perennials: {Perennials}<br />Annual Grasses: {AnnualGrasses}<br />Annual Forbs: {AnnualForbs}<br />Other Items: {OtherItems}<br />Line Length: {LineLength}<br />Interval: {Interval}<br />Option: {Option_}<br />HT Interval: {HTInterval}<br />Show Shape: {ShrubShape} </p>
0 Kudos
1 Reply
by Anonymous User
Not applicable

Pardon the typo.  No need for quotes around the html string being passed in  should be as follows...

popupWV.loadDataWithBaseURL(null, x, "text/html", "UTF-8", null);
0 Kudos