4

首先,我的问题与各种与 API 密钥相关的 MapView 磁贴问题不同,它也与这个问题那个问题不匹配,尽管它确实有相似之处。

有时我遇到几个瓦片无法加载,在 Android MapView 上留下空白的灰色点。
LogCat 显示了这一点:

05-15 11:55:01.178: W/System.err(11978): IOException processing: 26
05-15 11:55:01.178: W/System.err(11978): java.io.EOFException
05-15 11:55:01.178: W/System.err(11978):    at java.io.DataInputStream.readFully(DataInputStream.java:267)
05-15 11:55:01.178: W/System.err(11978):    at java.io.DataInputStream.readFully(DataInputStream.java:212)
05-15 11:55:01.178: W/System.err(11978):    at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readImageData(BaseTileRequest.java:194)
05-15 11:55:01.178: W/System.err(11978):    at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:124)
05-15 11:55:01.178: W/System.err(11978):    at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
05-15 11:55:01.178: W/System.err(11978):    at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
05-15 11:55:01.178: W/System.err(11978):    at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
05-15 11:55:01.178: W/System.err(11978):    at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
05-15 11:55:01.188: W/System.err(11978):    at java.lang.Thread.run(Thread.java:1027)

当您在地图上移动和缩放时旋转设备时,可以在仅包含 MapView 的准系统应用程序中重现这一点。不过,它并非一直都在发生。也许有某种竞争条件。

package my.TestApp;

import com.google.android.maps.*;

import android.os.Bundle;

public class MainActivity extends MapActivity  {

MapView mapView;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
    }

    @Override
    protected boolean isRouteDisplayed() {
        return false;
    }
}

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mainlayout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <com.google.android.maps.MapView
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:clickable="true"
        android:apiKey="MyApiKeyGoesHere"
    />

</RelativeLayout>
4

0 回答 0