4. Code implementations |
1 2 3 | < uses-permission android:name = "android.permission.WRITE_EXTERNAL_STORAGE" /> < uses-permission android:name = "android.permission.INTERNET" /> < uses-permission android:name = "android.permission.ACCESS_NETWORK_STATE" /> |
1 | < uses-sdk android:minSdkVersion = "3" android:targetSdkVersion = "8" /> |
1 2 3 4 5 6 7 8 9 10 11 12 13 | <? xml version = "1.0" encoding = "utf-8" ?> < RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:id = "@+id/container" android:layout_width = "fill_parent" android:layout_height = "fill_parent" android:orientation = "vertical" > < com.supermap.android.maps.MapView android:id = "@+id/mapview" android:layout_width = "fill_parent" android:layout_height = "fill_parent" android:clickable = "true" android:enabled = "true" /> </ RelativeLayout > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | package com.supermap.sample; import com.supermap.android.maps.LayerView; import com.supermap.android.maps.MapView; import android.app.Activity; import android.content.res.Configuration; import android.os.Bundle; public class GettingStartedActivity extends Activity { // Maps provided by SuperMap iServer use a fixed address for delivering private static final String DEFAULT_URL = "http://192.168.120.41:8091/iserver/services/map-china400/rest/maps/China" ; protected MapView mapView; @Override public void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContentView(R.layout.iclient_android_app); } @Override public void onConfigurationChanged(Configuration newConfig) { super .onConfigurationChanged(newConfig); } } |
1 2 3 4 5 6 7 8 9 | //Create a mapview mapView = (MapView) this .findViewById(R.id.mapview); //Create a map layer and point at map services provided by iServer LayerView layerView = new LayerView( this ); layerView.setURL(DEFAULT_URL); //Set map scaling mapView.setBuiltInZoomControls( true ); //Load a map layer mapView.addLayer(layerView); |