Android's simplest mobile map app--has only three parts.
The first part
first set up a mapactivity in Setcontentview (r.layout. Activity_map ); Create a <webview> code as follows.
<?xml version= "1.0" encoding= "Utf-8"? ><relativelayout xmlns:android= "http://schemas.android.com/apk/res/ Android " xmlns:tools=" Http://schemas.android.com/tools " android:layout_width=" Match_parent " android:layout_height= "Match_parent" tools:context= "com.example.jreduch7292.MapActivity" ><webview android:layout_width= "match_parent" android:layout_height= "match_parent" android:id= "@+id/wv1" ></WebView></RelativeLayout>
Part II
Write the following code in Mapactivity:
Package Com.example.jreduch7292;import Android.support.v7.app.appcompatactivity;import Android.os.Bundle;import Android.webkit.webchromeclient;import Android.webkit.websettings;import Android.webkit.webview;import Android.webkit.webviewclient;public class Mapactivity extends Appcompatactivity { @Override protected void OnCreate (Bundle savedinstancestate) { super.oncreate (savedinstancestate); Setcontentview (R.LAYOUT.ACTIVITY_MAP); WebView wv= (WebView) Findviewbyid (R.ID.WV1); WebSettings ws=wv.getsettings (); Ws.setdisplayzoomcontrols (true); Ws.setsupportzoom (true); Ws.setjavascriptenabled (true); Wv.setwebviewclient (New Webviewclient ()); Wv.setwebchromeclient (New Webchromeclient ()); Wv.loadurl ("http://m.amap.com/?q=31.234527,121.287689");} }
Part III
adding network permissions in the Androidmanifest.xml manifest file allows you to
<uses-permission android: name="Android.permission.INTERNET"/ >
Network permissions
<?xml version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "http://schemas.android.com/apk/res/ Android "package=" com.example.jreduch7292 "> <uses-permission android:name=" Android.permission.INTERNET "/ > <uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/> <application androi D:allowbackup= "true" android:icon= "@mipmap/ic_launcher" android:label= "@string/app_name" Android:supp Ortsrtl= "true" android:theme= "@style/apptheme" > <activity android:name= ". Viewpageractivity "/> <activity android:name=". Bujuactivity "></activity> <activity android:name=". Mapactivity "> <intent-filter> <action android:name=" Android.intent.action.MAIN "/> ; <category android:name= "Android.intent.category.LAUNCHER"/> </intent-filter> </activity& Gt </application></manifest>
Android's simplest mobile map app (just 5 minutes)