Android的 - 地图无法显示 [英] Android - Maps Cannot show

查看:94
本文介绍了Android的 - 地图无法显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的Andr​​oid应用程序显示谷歌地图。秀我做这样的一些基本步骤:

i wanna show google maps on my android application. show i do some basic step like this :

AndroidManifest.xml中

AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />

maps.xml

maps.xml

<view android:id="@+id/mv"
        class="com.google.android.maps.MapView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1" 
        android:clickable="true"
        android:apiKey="0cNoErXkpZDlKvCYr_OFj5xZD39-***********"
    />

这是5月的地图类,进口和onCreate方法

and this is may maps class, import and onCreate method

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import android.os.Bundle;

方法的onCreate()在地图上的类

method onCreate() on maps class

    public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.maps);

    mapView = (MapView)findViewById(R.id.mv);
    mapView.setSatellite(false);
    mapView.setTraffic(false);
    mapView.setBuiltInZoomControls(true);

    int maxZoom = mapView.getMaxZoomLevel();
    int initZoom = maxZoom-2;

    mapControl = mapView.getController();
    mapControl.setZoom(initZoom);

    latE6 = (int) (lat*1e6);
    lonE6 = (int) (lon*1e6);
    gp = new GeoPoint(latE6, lonE6);
    mapControl.animateTo(gp);

    overlayButton = (Button)findViewById(R.id.doOverlay);

但为什么我的地图上没有显示,我只看到了网格地图内部消除,当我尝试阅读的logcat,我看到这个错误与黄色

but why my map didnt show, i only see the grid whithout maps, and when i try to read logcat, i see this error with yellow color

Recycling dispatcher android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher@40563470

请帮助我。感谢队友

推荐答案

您确定您的API密钥是正确的?当API密钥不匹配,它显示了格,而不是地图。

Are you sure your API key is correct? When the API key doesn't match, it shows the grid instead of the map.

直接运行在仿真器上从Eclipse的应用程序/实际手机需要不同的键,然后当你第一次生成的.apk文件,并运行在设备上。

Running the app from Eclipse directly on the emulator / an actual phone requires a different key then when you build the .apk file first and run that on a device.

这篇关于Android的 - 地图无法显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆