问题描述
- android基于天地图开发遇见的问题
-
这是activity界面的代码:
package com.example.tianditu;import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;import com.tianditu.android.maps.GeoPoint;
import com.tianditu.android.maps.MapActivity;
import com.tianditu.android.maps.MapController;
import com.tianditu.android.maps.MapView;public class MainActivity extends MapActivity {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MapView mMapView = (MapView) findViewById(R.id.main_mapview); //设置启用内置的缩放控件 mMapView.setBuiltInZoomControls(true); //得到mMapView的控制权,可以用它控制和驱动平移和缩放 MapController mMapController = mMapView.getController(); //用给定的经纬度构造一个GeoPoint,单位是微度 (度 * 1E6) GeoPoint point = new GeoPoint((int) (39.915 * 1E6), (int) (116.404 * 1E6)); //设置地图中心点 mMapController.setCenter(point); //设置地图zoom级别 mMapController.setZoom(12); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; }
}
这是Manifest界面的代码:
<?xml version="1.0" encoding="utf-8"?>
package="com.example.tianditu"
android:versionCode="1"
android:versionName="1.0" ><uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.example.tianditu.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application>
整个程序都没有报错,但是运行之后就会出现“Target host must not be null, or set in parameters. scheme=null, host=null, path=“错误,求教各位大神,出错在哪里
解决方案
http://m.blog.csdn.net/blog/qq294661/42081081
时间: 2024-10-26 01:56:38