的GetMap()返回null [英] getMap() returning null

查看:1231
本文介绍了的GetMap()返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的GetMap()方法返回null。为什么这个方法返回null?我看了看在Android开发者文档,以确保我正确地使用这种方法。这里的code,我使用来获得地图中的路线:

My getMap() method is returning null. Why is this method returning null? I looked on the Android Developers documentation to make sure I'm using this method correctly. Here a the line of code that I'm using to get the map:

mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.myMapView)).getMap();

下面是我的Java code:

Here is my Java code:

private ProjectionProxy proxy = new ProjectionProxy();

private GoogleMap mMap;

@Override
protected void onCreate(Bundle load) { 
    super.onCreate(load);

    setContentView(R.layout.fragment_ride_tracking);

    mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.myMapView)).getMap();

    Log.e("RideTracking", "Google Map VALUE:"+mMap);

    if (mMap != null) { 
        proxy.setProjection(mMap.getProjection());
    }

下面是我的XML $ C $下的特定部分的code:

Here is my XML code for that particular piece of code:

   <fragment 
    android:id="@+id/myMapView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:name="com.google.android.gms.maps.MapFragment"/>

下面是logcat的输出:

Here is the logcat output:

05-09 12:49:34.282: W/GooglePlayServicesUtil(5928): Google Play services out of date.  Requires 3027100 but found 2012110
05-09 12:49:34.282: E/RideTracking(5928): Google Map VALUE:null
05-09 12:49:34.302: E/OGT.GPSLoggerServiceManager(5928): No GPSLoggerRemote service connected to this manager
05-09 12:49:34.322: W/dalvikvm(5928): Unable to resolve superclass of Lcom/android/gpstracker/viewer/FixedMyLocationOverlay; (2174)
05-09 12:49:34.322: W/dalvikvm(5928): Link of class 'Lcom/android/gpstracker/viewer/FixedMyLocationOverlay;' failed
05-09 12:49:34.322: W/dalvikvm(5928): Unable to resolve superclass of Lcom/android/gpstracker/viewer/FixedMyLocationOverlay; (2174)

任何帮助将是很大的AP preciated!

Any help would be greatly appreciated!

推荐答案

显然,行

05-09 12:49:34.282: W/GooglePlayServicesUtil(5928): Google Play services out of date.  Requires 3027100 but found 2012110

告诉我们,为什么地图上没有实例化。

tells us why the map isn't instantiated.

您需要有谷歌的最新版本的播放服务,您的设备上,否则你会得到这样的:

的GetMap()返回

You need to have a current version of Google Play services on your device or else you get this:

and getMap() will return null.

这篇关于的GetMap()返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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