Create a new ArcGIS for Android project and display a local map

Source: Internet
Author: User

1. Preparation: First configure the Android development Environment, then install the ArcGIS for Android development control in Eclipse ; Publish a local map service in Arccatalog.

2. After installing ArcGIS for Android development controls, a new project in eclipse will appear with the ArcGIS Project for Android option and the ArcGIS Samples for Android option. Here we choose Arcgisproject for Android.

3. Enter project name, next, the package name needs to be modified here, similar to the following: Com.esri. Project name. Activity. Pay special attention to choosing the TARGETSDK that matches your simulator here.

4. Click Done to create an ArcGIS for Android project in Eclipse, with the following structure:

Here is the 4.2.2 Android virtual machine, 10.2.3 version of the ArcGIS for Android plugin.

5. The next step is to show the map published in catalog in the adroid virtual. First, you need a control to put the map, Android is using Mapview, the specific code is as follows:

1 @Override2      Public voidonCreate (Bundle savedinstancestate) {3         Super. OnCreate (savedinstancestate);4 Setcontentview (r.layout.main);5         6Mmapview =NewMapview ( This);7Mmapview.setlayoutparams (Newlayoutparams (layoutparams.fill_parent, layoutparams.fill_parent));8Arcgisdynamicmapservicelayer MMAP =NewArcgisdynamicmapservicelayer ("HTTP//native IP address/arcgis/rest/services/achina/mapserver"));9 Mmapview.addlayer (MMAP);Ten Setcontentview (mmapview); One}

Note: The map service address is required to display the map, and you need to use the local IP address to access it.

6. Add the above code, save, run, you can display the following effect:

7.ok, the map shows, the next section is about how to remove the "Licensed for Developer using only" watermark and the use of Actionbar. Thank you.

Create a new ArcGIS for Android project and display a local map

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.