jav_cn 2015-11-13 10:52 采纳率: 57.1%
浏览 3406

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=“错误,求教各位大神,出错在哪里

  • 写回答

1条回答 默认 最新

  • threenewbee 2015-11-14 13:27
    关注
    评论

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况