Arcgis Runtime SDK for Android (ii) First program Holle MAP

Source: Internet
Author: User

To tell the truth, I stuck in the first program for a long time, do not know people feel too simple, do not want to talk to me, very helpless, but accustomed to. Do things on your own.

Before doing this, you need to make sure your environment is set up, preferably your first Android app Hello world! Also run, the following Hello map will become very simple.

Do the first program, what you need is nothing to know, just need, I do what you do, because I do not know much, answer not many of your questions, I am also a beginner, write this is the main mental journey. In fact, when you have the foundation of Android Development, to see this thing is more relaxed, otherwise, and I just started as hard.

According to the guide of the official website, we can actually do a good hello map.

A: First the Android Runtime SDK has been updated, from 10.2x to 100.1, there are many new changes and adjustments. Notable, is also very pit daddy, it has increased permissions on the Android API, the minimum is how much, I did not test, but the recommendation is 23, because there may be access to the Internet restrictions. The specific need to see "Most of the applications developed by the ArcGIS SDK that you run for Android require this feature and minimal permissions", and you can also crossing the Web's guide more detailed than I do.

Second: the need for scientific access to the Internet, because Android studio to launch the first program when the need to request Gradle related files, very slow, especially when you download from GitHub source code is, start the program, Gradle download is very slow, the best way to solve is scientific internet , you can also go to Baidu download Gradle image, but it is very cumbersome, you need to download the version of the relative, or it crashes, online can be tried on the scientific Internet tools, a few minutes can be good.

Three: Or say a lot of nonsense, the following steps to explain the beginning

Start as, new project, do not Chinese, to adapt to all English this thing.

App Name Hello map others can be used without a tube.

API I choose 23, because may require access to the Internet, the following wearable device can not be considered

Select an empty activity.

The same is the name, one is the activity of a layout

The following can be roughly divided into 7 steps, perhaps I understand the wrong, also ask the reader to guide

One: Add ESRI public one called Bintray maven repository, to tell Gradle where to look for Android dependent ArcGIS Runtime SDK, according to the URL of the specified maven library. Picture I will enlarge.

ADD the Esri public Bintray Maven Repository
Maven {
URL ' Https://esri.bintray.com/arcgis '
}

Two: Add dependencies section, note case.

Compile ' com.esri.arcgisruntime:arcgis-android:100.1.0 '

Three: On the Android Studio toolbar, click the Project file Sync tool. Or, when you see a change in the Gradle file Project Sync message at the top of the Gradle script window, click Sync Now.

These two are meant to be a hint that requires project file synchronization. If you choose API Default 15, you will get an error. Very stiff.

Four: Notify Android launcher that your app requires access to the Internet. If the application is running at Android API level 23 or higher, request normal permissions at installation, Internet access is normal, so no additional work is required to enable this permission. It also indicates that your application requires OpenGL version 2 software features to run the application.

<uses-permission android:name= "Android.permission.INTERNET"/>
<uses-feature android:glesversion= "0x00020000" android:required= "true"/>

Five: Add a view of the active layout. Delete the original text view, the classic Hello World
<com. ESRIarcgisruntime.mapping. View
Android:id=
Android:layout_width="Fill_parent"
android:layout_height=
</com. ESRIarcgisruntime. Mapping. View. mapview>

Six:

(1) Add the following class variable declaration at the top of the Mainactivityclass:

Private MapView mMapView;

(2) Import Mapview class, put the mouse in the red Word position, press Alt+enter.

Import com. Esri. Arcgisruntime. Mapping. Arcgismap;

Import com. Esri. Arcgisruntime. Mapping. Basemap;

Import com. Esri. Arcgisruntime. mapping.view. Mapview;

(3) OnCreate method, add after SetcontentviewmMapView的展示设定

mMapView = (MapView) findViewById(R.id.mapView);
Map  New  34.056295  -117.195800  16
mMapView.setMap(Map);

Seven: Run the program, select the device, get the result.

This completes the Hello map program.

Then I don't know much about the OnPause and Onresume methods on the official website. This needs to know about the four components and knowledge of Android.

In fact, still have to look at the development of Android knowledge, otherwise too difficult, personally feel the simplest way is to first understand the knowledge, and then write a calculator, calendar, Notepad, flashlight and other simple procedures are better to get started.

 
 

Arcgis Runtime SDK for Android (ii) First program Holle 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.