Hello, I am a new developer for android and i am developing ArcGIS
Application for Android. I am using the Eclipse IDE, JDK and JRE for
java 7, ADT Bundle 21.1.0, Android SDK for Window (64 Bits) and ArcGIS
Runtime SDK 10.1 Plugin and the I am also using Android ADT bundle in
other machine with ArcGIS Runtime plugin. MY problem is When i am trying
to add the ArcGIS Feature Layer its show the error like as
StringwmsURL cannot be resolved to a variable and
wmsURL cannot be resolved to a variable..... after that when when i am adding the callout its show some error like as- xml cannot be resolved or is not a field and when i am add the popup in specific layer of web map its show more error like as rename the variable and variable cannot be resolve.
If my code is incorrect what is the correct code and can you provide me.
The application code taken from the ArcGIS tutorial and the link of tutorial are:
http://resources.arcgis.com/en/help/android-sdk/concepts/index.html#/Welcome_to_the_help_for_ArcGIS_Runtime_SDK_for_Android/011900000024000000/
code for Feature layer:
String URL = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/0";
ArcGISFeatureLayer fLayer = new ArcGISFeatureLayer(URL, MODE.ONDEMAND);
http://<server:port>/<instance>/services/<service>/MapServer/WMSServer
StringwmsURL = "http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StateCityHighway_USA/MapServer/WMSServer";
WMSLayer wmsLayer = new WMSLayer(wmsURL);
map.addLayer(wmsLayer);
String[] visibleLayers = {"ushigh", "counties"};
wmsLayer.setVisibleLayer(visibleLayers);
WMSLayerInfo[] wmsLayerInfo = wmsLayer.getLayers();
Code for callout:
Object callout;
callout.setStylefindViewByXML(R.xml.countrypop);
Graphic gr;
String countyName = (String) gr.getAttributeValue("NAME");
String countyPop = gr.getAttributeValue("POP07_SQMI").toString();
// Sets custom content layout to callout. callout.setContent(loadView(countyName,countyPop));
code for Popup: its show more error show i cannot give the colour of error.
Thanks.
StringwmsURL cannot be resolved to a variable and
wmsURL cannot be resolved to a variable..... after that when when i am adding the callout its show some error like as- xml cannot be resolved or is not a field and when i am add the popup in specific layer of web map its show more error like as rename the variable and variable cannot be resolve.
If my code is incorrect what is the correct code and can you provide me.
The application code taken from the ArcGIS tutorial and the link of tutorial are:
http://resources.arcgis.com/en/help/android-sdk/concepts/index.html#/Welcome_to_the_help_for_ArcGIS_Runtime_SDK_for_Android/011900000024000000/
code for Feature layer:
String URL = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/0";
ArcGISFeatureLayer fLayer = new ArcGISFeatureLayer(URL, MODE.ONDEMAND);
http://<server:port>/<instance>/services/<service>/MapServer/WMSServer
StringwmsURL = "http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StateCityHighway_USA/MapServer/WMSServer";
WMSLayer wmsLayer = new WMSLayer(wmsURL);
map.addLayer(wmsLayer);
String[] visibleLayers = {"ushigh", "counties"};
wmsLayer.setVisibleLayer(visibleLayers);
WMSLayerInfo[] wmsLayerInfo = wmsLayer.getLayers();
Code for callout:
Object callout;
callout.setStylefindViewByXML(R.xml.countrypop);
Graphic gr;
String countyName = (String) gr.getAttributeValue("NAME");
String countyPop = gr.getAttributeValue("POP07_SQMI").toString();
// Sets custom content layout to callout. callout.setContent(loadView(countyName,countyPop));
code for Popup: its show more error show i cannot give the colour of error.
MapViewmap=…;PopupContainerpopupContainer=newPopupContainer(map);
MapViewmap=…;Layerlayer=…;intsubLayerId=…;Graphicgraphic=…;……Popuppopup=layer.createPopup(map,subLayerId,graphic);
MapViewmap=…;ArcGISFeatureLayerfeatureLayer=…;Graphicgraphic=…;……Popuppopup=featureLayer.createPopup(map,0,graphic);
Popuppopup=…;// create popupPopupContainerpopupContainer=…;popupContainer.addPopup(popup);// add popup to popup container
// Create a dialog for the popups and display it.PopupDialogpopupDialog=newPopupDialog(map.getContext(),popupContainer);...// A customize full screen dialog.privateclassPopupDialogextendsDialog{privatePopupContainerpopupContainer;publicPopupDialog(Contextcontext,PopupContainerpopupContainer){super(context,android.R.style.Theme);this.popupContainer=popupContainer;}@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);LayoutParamsparams=newLayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);LinearLayoutlayout=newLinearLayout(getContext());layout.addView(popupContainer.getPopupContainerView(),android.widget.LinearLayout.LayoutParams.FILL_PARENT,android.widget.LinearLayout.LayoutParams.FILL_PARENT);setContentView(layout,params);}}
MapViewmap=…;ArcGISTiledMapServiceLayertiledLayer=…;ArcGISLayerInfolayerInfo=…;Envelopeenv=…;Popuppopup;intlayerID=layerInfo.getId();StringlayerUrl=tiledLayer.getQueryUrl(layerID);if(layerUrl==null)layerUrl=tiledLayer.getUrl()+"/"+layerID;ArcGISPopupInfopopupInfo=tiledLayer.getPopupInfo(layerID);Queryquery=newQuery();query.setInSpatialReference(sr);query.setOutSpatialReference(sr);query.setGeometry(env);query.setOutFields(newString[]{"*"});QueryTaskqueryTask=newQueryTask(layerUrl);try{FeatureSetresults=queryTask.execute(query);for(Graphicgraphic:results.getGraphics()){popup=tiledLayer.createPopup(map,layerID,graphic);popupContainer.addPopup(popup);}}catch(Exceptione){e.printStackTrace();}
// Add PopupPopuppopup=featureLayer.createPopup(map,0,graphic);popup.setEditMode(true);popupContainer.addPopup(popup);
Popuppopup=…;Graphicgr=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());}Graphicnewgr=newGraphic(gr.getGeometry(),null,attributes,null);
Popuppopup=…;popup.setPopupListener(this);popup.setEditMode(true);……@OverridepublicvoidonPopupModified(){Log.i(IOUtils.TAG,"onPopupModified");mModified=true;ViewtitleView=getPopup().getLayout().getTitleView();if(titleView!=null&&titleViewinstanceofArcGISTitleView){Symbolsymbol=((ArcGISTitleView)titleView).getSymbol();if(symbol!=null&&symbol!=mSymbol){Log.i(IOUtils.TAG,"onPopupModified: update symbol");mSymbol=symbol;addFeature(mCurrentLocation);}}……;}@OverridepublicvoidonPopupValidityChanged(booleanisValid){Log.i(IOUtils.TAG,"onPopupValidityChanged");mModified=true;mValid=isValid;}
PopupContainerpopupContainer=…;popupContainer.setPopupBackgroundColor(Color.WHITE);// popup background colorpopupContainer.setPopupTextColor(Color.BLACK);// text colorpopupContainer.setPopupSelectorColors(Color.BLUE,Color.RED,Color.CYAN,Color.MAGENTA);// selector colors
Thanks.