【问题标题】:Displaying MapView in an android device [closed]在 android 设备中显示 MapView [关闭]
【发布时间】:2013-07-27 08:02:28
【问题描述】:

实际上,我在这里使用 Google Play 服务在 android sdk 中遵循 Google 地图教程。但是在我的真实设备中没有得到任何MapView。请帮助解决这个问题。

【问题讨论】:

标签: android google-maps android-mapview


【解决方案1】:

您必须检查您的设备中是否安装了 Google Play 服务

Google Play 服务用于更新 Google 应用和来自 Google Play 的应用。此组件可让您访问 Google 设置并帮助应用加快离线搜索速度、提供更具沉浸感的地图并提高性能。 如果您卸载 Google Play 服务,应用程序可能无法运行。你可能需要这个组件。

得到它here

【讨论】:

    【解决方案2】:

    Android 版 Google 地图是地图 v2。 Google maps v2 不再支持 mapview(如果您有旧的 api 密钥,它将适用于 maps v1,但如果您需要新密钥,他们会停止服务)。所以我建议你继续使用 maps v2 并使用下面的代码或使用代码下面提到的教程

    // Getting Google Play availability status
    int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());                
    if(status!=ConnectionResult.SUCCESS){ // Google Play Services are not available
    int requestCode = 10;
    Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, requestCode);
    dialog.show();
    }
    
    else 
    { // Google Play Services are available     
    
    // Getting reference to the SupportMapFragment
    SupportMapFragment fragment = ( SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapfragment);
    
    // Getting Google Map
    mGoogleMap = fragment.getMap();
    

    ==============================================

    您也可以关注本教程http://www.vogella.com/articles/AndroidGoogleMaps/article.html

    【讨论】:

    • 非常感谢您对获取 mapview 的指导,我正在通过我的应用程序 @Balavishnu 获取地图视图。
    猜你喜欢
    • 2014-02-05
    • 1970-01-01
    • 2012-05-11
    • 1970-01-01
    • 2013-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多