轉自:http://blog.csdn.net/wozaifeiyang0/article/details/7327423緩存
看到這個標題是不是很激動,如題,該示例就是添加一個離線地圖,這應該是不少開發人員期盼已久的功能了吧,正式版一處這個應該是一個很大的亮點,原來操做離線地圖如此簡單,下面來看一下代碼:spa
public void onCreate(Bundle savedInstanceState) {.net super.onCreate(savedInstanceState);blog setContentView(R.layout.main);ci map = (MapView) findViewById(R.id.map);開發
//the data is stored on the SDCARDtable //the data is created as a tiled cachefile local = new ArcGISLocalTiledLayer("file:///mnt/sdcard/<CacheName>/Layers");map map.addLayer(local);地圖
} |
看到了嗎,代碼沒多少,但盡顯精華,咱們只需將離線地圖的緩存切片拷貝到咱們的sd卡中,而後修改一下ArcGISLocalTiledLayer中的相應路徑就能夠正常顯示一幅離線地圖了,不要忘記把離線地圖服務添加到「MapView」中。