Feature Layer

3014
5
01-05-2012 11:20 AM
JayKappy
Occasional Contributor
Just trying to add a featureLayer and having issues...anyone know why

Would be cool to figure out how to add in xml and in the java page

Main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<!-- MapView layout and initial extent -->
<com.esri.android.map.MapView
 android:id="@+id/map"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 initExtent = "-1.3296373526814876E7 3930962.41823043 -1.2807176545789773E7 4201243.7502468005">.

 <com.esri.android.map.ags.ArcGISFeatureLayer
 Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/2"  
    mode="snapshot" />

</com.esri.android.map.MapView>

 
</LinearLayout>



Java:
Anyone know how to add a feature layer to the .java page as well.....I can add DynamicMapServiceLAyers like this...but cant fidn out how to do a Feature Layer

public class AndroidTestingActivity extends Activity {
 
 MapView map = null;

 /** Called when the activity is first created. */
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);

  // Retrieve the map and initial extent from XML layout
  map = (MapView)findViewById(R.id.map);
  // Add dynamic layer to MapView
  map.addLayer(new ArcGISTiledMapServiceLayer("" +
    "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"));
  map.addLayer(new ArcGISDynamicMapServiceLayer("" +
    "http://gis.logis.org/arcgis/rest/services/MG_Test/MapServer/5"));
0 Kudos
5 Replies
JayKappy
Occasional Contributor
Anyone done this before...I have the app running on my phone with some aerials from the example...but now trying to add a layer from another ESRI example...cant seem to get it to work...
I am trying both ways above...the world imagery works but the other does not

Thgouths?  THanks

I tried this but getting errors...

map.addLayer(new ArcGISFeatureLayer("" +
 "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/2"));
0 Kudos
JayKappy
Occasional Contributor
Anyone know why this is not working
0 Kudos
SaurabhGupta
New Contributor II
Hi,

You seem to using an incorrect constructor.
Please use this :
public ArcGISFeatureLayer(String url,
                          ArcGISFeatureLayer.MODE mode)

    Parameters:
        url - the the URL of the feature layer service.
        mode - the feature layer mode.

http://help.arcgis.com/en/arcgismobile/10.0/apis/android/api/com/esri/android/map/ags/ArcGISFeatureL...
0 Kudos
JayKappy
Occasional Contributor
Saurabh - Thank you that was exactly it....worked like a charm...
Now that I can add my Feature Layers....any advice on where to go to allo the user to click on a feature and edit its attributes?

Thanks again
Have a great weekend
0 Kudos
SaurabhGupta
New Contributor II
0 Kudos