3 Replies Latest reply on Apr 16, 2012 10:58 AM by JFA0427

    How do you change the extent on Helloworld?

    JFA0427
      How do you change the (initExtent = ) on the Helloworld application from ESRI?

      I just want my app to open to a different location other than San Diego.

      The Helloworld app's extent code looks like this:
      initExtent = "-1.3296373526814876E7 3930962.41823043 -1.2807176545789773E7 4201243.7502468005">

      What projection or coordinate system is that?

      Need some guidance.
        • Re: How do you change the extent on Helloworld?
          simra
          You could change the initExtent in the xml layout file to the one you like.
          The numbers should be an Envelope I guess.

          You could navigate and zoom to the location and zoomlevel you want and add an singletab listener to the map.
          So when you are at the location you want print the mapView.getExtent in the onsingletab method. The coordinates of this polygon you then could set as your initial extent in the xml.
          • Re: How do you change the extent on Helloworld?
            JFA0427
            I figured it out.

            ESRI's World Street Map - map service is in Web Mercator.

            I published my own map service with some point data located on the area i needed to be zoomed into, and made sure the map layer coordinate system in ArcMap was set to Web Mercator (Auxillery) then published it as a map service

            I changed the Hello world code to look like this:

            JAVA CODE:
            ________________
            package com.dhec.MPOS;

            import com.esri.android.map.MapView;
            import com.esri.android.map.ags.ArcGISDynamicMapServiceLayer;
            import com.esri.android.map.ags.ArcGISTiledMapServiceLayer;
            import android.app.Activity;
            import android.os.Bundle;

            public class Mapscreen extends Activity {
            MapView map = null;

            /** 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);
              // Add dynamic layer to MapView
              map.addLayer(new ArcGISTiledMapServiceLayer("" +
              "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"));
              map.addLayer(new ArcGISDynamicMapServiceLayer("" +
                 "http://<myserver>/ArcGIS/rest/services/Mobile/TESTJohn/MapServer"));

            }

            protected void onPause() {
              super.onPause();
              map.pause();
            }

            protected void onResume() {
              super.onResume();
              map.unpause();
            }
            }
            _______

            For the initExtent = ""

            I used the initial extent from the rest service from my map service i published.
            • Re: How do you change the extent on Helloworld?
              JFA0427
              Note: In the above code I removed my server name and put <my server>.
              If you copy and paste, make sure you actually put your server.