Hello World for GIS

来源:互联网 发布:ecshop php版本 编辑:程序博客网 时间:2024/06/05 02:35
  1.  
  2. package com.esri.arcgis.android.samples.helloworld;
  3. import android.app.Activity;
    import android.os.Bundle;
  4. import com.esri.android.map.MapView;
    import com.esri.android.map.ags.ArcGISTiledMapServiceLayer;
  5. /**
     * The HelloWorld app is the most basic Map app
     * for the ArcGIS Runtime SDK for Android.
     * It shows how to create a {@link #mMapView} object
     * and populate it with a {@link #tileLayer} and
     * show the layer on the map. 
     *
     * @author EsriAndroidTeam
     * @version 2.0
     *
     */
  6. public class HelloWorld extends Activity {
     MapView mMapView = null;
     ArcGISTiledMapServiceLayer tileLayer;
  7.  /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      
      // Retrieve the map and initial extent from XML layout
      mMapView = (MapView)findViewById(R.id.map);
      /* create a @ArcGISTiledMapServiceLayer */
      tileLayer = new ArcGISTiledMapServiceLayer(
        "
    http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
      // Add tiled layer to MapView
      mMapView.addLayer(tileLayer);
      
     }
     
  8.  @Override
     protected void onPause() {
      super.onPause();
      mMapView.pause();
     }
  9.  @Override
     protected void onResume() {
      super.onResume();
      mMapView.unpause();
     } 
     
    }
  10.  
原创粉丝点击