Android SupportFragment将Map Object返回为null

时间:2013-09-26 13:31:09

标签: android google-maps-android-api-2 google-play-services

我在我的Android应用程序中显示这样的地图:

mMap = ((SupportMapFragment)    getSupportFragmentManager().findFragmentById(R.id.map)).getMap();

片段的定义如下:

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:map="http://schemas.android.com/apk/res-auto"
  android:id="@+id/map"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  class="com.google.android.gms.maps.SupportMapFragment"
  map:cameraTargetLat="28.635308"
  map:cameraTargetLng="77.224960"
  map:uiCompass="true"
  map:uiRotateGestures="true"
  map:uiScrollGestures="true"
  map:uiTiltGestures="true"
  map:uiZoomControls="true"
  map:uiZoomGestures="true"/>

问题是在某些手机上它工作正常而在其他手机上(Android 2.2,2.3)它无法正常工作。在这些情况下,map对象为null。 对我来说,这背后的原因似乎是这些手机上没有安装谷歌播放服务。我是否正确,如果是,可能的解决方法是什么。

0 个答案:

没有答案
相关问题