MapView map = …; PopupContainer popupContainer = new PopupContainer(map);
MapView map = …; Layer layer = …; int subLayerId = …; Graphic graphic = …; …… Popup popup = layer.createPopup(map, subLayerId, graphic);
MapView map = …; ArcGISFeatureLayer featureLayer = …; Graphic graphic = …; …… Popup popup = featureLayer.createPopup(map, 0, graphic);
Popup popup = …; // create popup PopupContainer popupContainer = …; popupContainer.addPopup(popup); // add popup to popup container
// Create a dialog for the popups and display it. PopupDialog popupDialog = new PopupDialog(map.getContext(), popupContainer); ... // A customize full screen dialog. private class PopupDialog extends Dialog { private PopupContainer popupContainer; public PopupDialog(Context context, PopupContainer popupContainer) { super(context, android.R.style.Theme); this.popupContainer = popupContainer; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); LinearLayout layout = new LinearLayout(getContext()); layout.addView(popupContainer.getPopupContainerView(), android.widget.LinearLayout.LayoutParams.FILL_PARENT, android.widget.LinearLayout.LayoutParams.FILL_PARENT); setContentView(layout, params); } }
MapView map = …; ArcGISTiledMapServiceLayer tiledLayer = …; ArcGISLayerInfo layerInfo = …; Envelope env = …; Popup popup; int layerID = layerInfo.getId(); String layerUrl = tiledLayer.getQueryUrl(layerID); if (layerUrl == null) layerUrl = tiledLayer.getUrl() + "/" + layerID; ArcGISPopupInfo popupInfo = tiledLayer.getPopupInfo(layerID); Query query = new Query(); query.setInSpatialReference(sr); query.setOutSpatialReference(sr); query.setGeometry(env); query.setOutFields(new String[] {"*"}); QueryTask queryTask = new QueryTask(layerUrl); try { FeatureSet results = queryTask.execute(query); for (Graphic graphic : results.getGraphics()) { popup = tiledLayer.createPopup(map, layerID, graphic); popupContainer.addPopup(popup); } } catch (Exception e) { e.printStackTrace(); }
// Add Popup Popup popup = featureLayer.createPopup(map, 0, graphic); popup.setEditMode(true); popupContainer.addPopup(popup);
Popup popup = …; Graphic gr = popup.getGraphic(); Map<String, Object> attributes = gr.getAttributes(); Map<String, Object> updatedAttrs = popup.getUpdatedAttributes(); for (Entry<String, Object> entry : updatedAttrs.entrySet()) { attributes.put(entry.getKey(), entry.getValue()); } Graphic newgr = new Graphic(gr.getGeometry(), null, attributes, null);
Popup popup = …; popup.setPopupListener(this); popup.setEditMode(true); …… @Override public void onPopupModified() { Log.i(IOUtils.TAG, "onPopupModified"); mModified = true; View titleView = getPopup().getLayout().getTitleView(); if (titleView != null && titleView instanceof ArcGISTitleView) { Symbol symbol = ((ArcGISTitleView) titleView).getSymbol(); if (symbol != null && symbol != mSymbol) { Log.i(IOUtils.TAG, "onPopupModified: update symbol"); mSymbol = symbol; addFeature(mCurrentLocation); } } ……; } @Override public void onPopupValidityChanged(boolean isValid) { Log.i(IOUtils.TAG, "onPopupValidityChanged"); mModified = true; mValid = isValid; }
PopupContainer popupContainer = …; popupContainer.setPopupBackgroundColor(Color.WHITE); // popup background color popupContainer.setPopupTextColor(Color.BLACK); // text color popupContainer.setPopupSelectorColors(Color.BLUE, Color.RED, Color.CYAN, Color.MAGENTA); // selector colors