Android Studio Imports Third-party jar packages and. So dynamic libraries

Source: Internet
Author: User
<span id="Label3"></p><p><p>Day map Mobile API Download Center: http://api.tianditu.com/api-new/mobile/download.html</p></p><p><p><span style="font-size: 16px; font-family: 黑体;"><span style="font-size: 13px;">New Android project, unzip downloaded resources, See Help documentation, class reference package, sample, API Development Package</span></span></p></p><p><p><span style="font-size: 16px; font-family: 黑体;"><span style="font-size: 13px;"></span></span></p></p><p><p><span style="font-size: 16px; font-family: 黑体;"><span style="font-size: 13px;">Unzip the API development package and copy the jar package to the Libs in the project</span></span></p></p><p><p><span style="font-size: 16px; font-family: 黑体;"><span style="font-size: 13px;"></span></span></p></p><p><p>extracted files</p></p><p><p></p></p><p><p>Then create a new folder in main jnilibs, and copy the Armeabi folder inside</p></p><p><p></p></p><p><p>Adding Permissions in Manifist</p></p><pre><<span style="color: #000080; font-weight: bold;">Uses-permission<span style="color: #660e7a; font-weight: bold;">Android<span style="color: #0000ff; font-weight: bold;">: name=<span style="color: #008000; font-weight: bold;">"android.permission.ACCESS_NETWORK_STATE" ><br><br></<span style="color: #000080; font-weight: bold;">Uses-permission><br><br><<span style="color: #000080; font-weight: bold;">Uses-permission<span style="color: #660e7a; font-weight: bold;">Android<span style="color: #0000ff; font-weight: bold;">: name=<span style="color: #008000; font-weight: bold;">"android.permission.ACCESS_WIFI_STATE" ><br><br></<span style="color: #000080; font-weight: bold;">Uses-permission><br><br><<span style="color: #000080; font-weight: bold;">Uses-permission<span style="color: #660e7a; font-weight: bold;">Android<span style="color: #0000ff; font-weight: bold;">: name=<span style="color: #008000; font-weight: bold;">"android.permission.INTERNET" ><br><br></<span style="color: #000080; font-weight: bold;">Uses-permission><br><br><<span style="color: #000080; font-weight: bold;">Uses-permission<span style="color: #660e7a; font-weight: bold;">Android<span style="color: #0000ff; font-weight: bold;">: name=<span style="color: #008000; font-weight: bold;">"android.permission.CALL_PHONE" ><br><br></<span style="color: #000080; font-weight: bold;">Uses-permission><br><br><<span style="color: #000080; font-weight: bold;">Uses-permission<span style="color: #660e7a; font-weight: bold;">Android<span style="color: #0000ff; font-weight: bold;">: name=<span style="color: #008000; font-weight: bold;"><span style="color: #008000; font-weight:bold;" "android.permission.access_coarse_location"; <br> <br> </< Span style= "color: #000080; font-weight:bold; " >uses-permission> <br> <br> <<span style="color: #000080; font-weight:bold;">uses-permission <span style=" Color: #660e7a; font-weight:bold; ">android<span style="color: #0000ff; font-weight:bold;">:name= <span style="color: #008000; font-weight:bold;" "android.permission.read_phone_state"; <br> <br> </<span style="color: #000080; font-weight:bold; ">uses-permission> <br> <br> <<span style="color: #000080; font-weight:bold;">uses-permission <span style=" Color: #660e7a; font-weight:bold; ">android<span style="color: #0000ff; font-weight:bold;">:name= <span style="color: #008000; font-weight:bold;" "android.permission.write_external_storage"; <br> <br> </< Span style= "color: #000080; font-weight:bold; " >uses-permission> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></pre><p><p>Add Mapview to the layout page</p></p><pre><pre><<span style="color: #000080; font-weight: bold;">Com.tianditu.android.maps.MapView<br><span style="color: #000080; font-weight: bold;"><br><span style="color: #660e7a; font-weight: bold;">Android<span style="color: #0000ff; font-weight: bold;">: id=<span style="color: #008000; font-weight: bold;">"@+id/amapview"<br><span style="color: #008000; font-weight: bold;"><br><span style="color: #660e7a; font-weight: bold;">Android<span style="color: #0000ff; font-weight: bold;">: layout_width=<span style="color: #008000; font-weight: bold;">"fill_parent"<br><span style="color: #008000; font-weight: bold;"><br><span style="color: #660e7a; font-weight: bold;">Android<span style="color: #0000ff; font-weight: bold;">: layout_height=<span style="color: #008000; font-weight: bold;">"fill_parent"/></span> </span></span></span></span></span></span></span></span></span></span></span></span></pre></pre><p><p>and add code in the Oncreat method of the background code</p></p><pre>Mapview Mmapview = (mapview) Findviewbyid (r.id.<span style="color: #660e7a; font-weight: bold; font-style: italic;">amapview);<br><br><span style="color: #808080; font-style: italic;">//<span style="color: #808080; font-style: italic; font-family: ‘宋体‘;">Setting enable built-in zoom controls<br><span style="color: #808080; font-style: italic; font-family: ‘宋体‘;"><br>Mmapview.setbuiltinzoomcontrols (<span style="color: #000080; font-weight: bold;">true);<br><br><span style="color: #808080; font-style: italic;">//<span style="color: #808080; font-style: italic; font-family: ‘宋体‘;">Get<span style="color: #808080; font-style: italic;">Mmapview<span style="color: #808080; font-style: italic; font-family: ‘宋体‘;">The right to control<span style="color: #808080; font-style: italic;">,<span style="color: #808080; font-style: italic; font-family: ‘宋体‘;">It can be used to control and drive panning and zooming<br><span style="color: #808080; font-style: italic; font-family: ‘宋体‘;"><br>Mapcontroller Mmapcontroller = Mmapview.getcontroller ();<br><br><span style="color: #808080; font-style: italic;">//<span style="color: #808080; font-style: italic; font-family: ‘宋体‘;">A given latitude and longitude is used to construct a<span style="color: #808080; font-style: italic;">GeoPoint<span style="color: #808080; font-style: italic; font-family: ‘宋体‘;">, the unit is the Micro-degree<span style="color: #808080; font-style: italic;">(<span style="color: #808080; font-style: italic; font-family: ‘宋体‘;">Degree<span style="color: #808080; font-style: italic;">* 1E6)<br><span style="color: #808080; font-style: italic;"><br>GeoPoint point =<span style="color: #000080; font-weight: bold;">New GeoPoint ((<span style="color: #000080; font-weight: bold;">Int) (<span style="color: #0000ff;"><span style="color: #0000ff;">39.915 * <span style="color: #0000ff;">1E6), (<span style="color: #000080; font-weight: bold;">int) (<span style="color: #0000ff;">116.404 * <span style="color: #0000ff;">1E6));<br><br><span style="color: #808080; font-style: italic;"><span style="color: #808080; font-style: italic; font-family: ‘宋体‘;">Set Map Center points<br><span style="color: #808080; font-style: italic; font-family: ‘宋体‘;"><br>Mmapcontroller.setcenter (point);<br><br><span style="color: #808080; font-style: italic;"><span style="color: #808080; font-style: italic; font-family: ‘宋体‘;">Set the map <span style="color: #808080; font-style: italic;">zoom <span style="color: #808080; font-style: italic; font-family: ‘宋体‘;">Level<br><span style="color: #808080; font-style: italic; font-family: ‘宋体‘;"><br>Mmapcontroller.setzoom (<span style="color: #0000ff;">n);</span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></pre><p><p>Run results</p></p><p><p></p></p><p><p></p></p><p><p>Android Studio Imports Third-party jar packages and. So dynamic libraries</p></p></span>

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.