JFA0427

XML with ArcGIS.com webmap

Discussion created by JFA0427 on Nov 27, 2012
Latest reply on Dec 11, 2012 by JFA0427
I'm using the sample code [PopupInWebMapForViewing] provided by ArcGIS SDK.

I placed my arcgis.com webmap link into the sample code and was able to view my map I created on arcgis.com as well as the popups I configured.

My question:

How do I add a button to my map view using the webmap mapview?
Do I use XML or do I code the button in java?

The sample code for viewing the map:

 /** Called when the activity is first created. */    
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    // Load a webmap.
    map = new MapView(this, "http://www.arcgis.com/home/item.html?id=ec84873154cf43069c407", "", "");
    setContentView(map);


I've used buttons before, but I called on my ArcGISDynamic map services in a slightly different way.

This is how I coded my button previously:

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

    // Retrieve the map and initial extent from XML layout
    map = (MapView) findViewById (R.id.map);
      
    // This adds ESRI's titled map service layer "World Street Map" to the MapView, as well as DHEC's 
    // dynamics map service "MPOS"
    map.addLayer(new ArcGISTiledMapServiceLayer("" +
    "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"));
    map.addLayer(new ArcGISDynamicMapServiceLayer("" +
    "http://TEST/ArcGIS/rest/services/Mobile/TRSS/MapServer"));
  
    //Setting up the button reference.
          ZoomToMyLocation = (Button) findViewById (R.id.button1);


Thanks,

Outcomes