Java 如何在旧版本的android操作系统中使用API V2显示Google地图(iam使用地图片段)
我在一个项目中,我想在谷歌地图上显示车辆的位置。我从Json web服务获取车辆的纬度和经度,在放置标记和设置位置方面没有问题 我的问题是,该应用程序在冰激凌沙巫婆和果冻豆操作系统手机上运行良好,当我尝试将该应用程序放入姜饼操作系统时,它正在强制关闭 在我的应用程序中,我使用的是Map片段和API V2。 我已经将android support v 13 jar文件添加到我的库中 这是我的舱单代码Java 如何在旧版本的android操作系统中使用API V2显示Google地图(iam使用地图片段),java,android,google-maps,android-fragments,Java,Android,Google Maps,Android Fragments,我在一个项目中,我想在谷歌地图上显示车辆的位置。我从Json web服务获取车辆的纬度和经度,在放置标记和设置位置方面没有问题 我的问题是,该应用程序在冰激凌沙巫婆和果冻豆操作系统手机上运行良好,当我尝试将该应用程序放入姜饼操作系统时,它正在强制关闭 在我的应用程序中,我使用的是Map片段和API V2。 我已经将android support v 13 jar文件添加到我的库中 这是我的舱单代码 enter code here <manifest xmlns:android="http
enter code here
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.tekguc.umut.googlemapsmapsandroidv2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="19"
/>
<permission
android:name="com.example.androidmapsv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature"></permission>
<uses-permission
android:name="com.example.androidmapsv2.permission.MAPS_RECEIVE"/>
<uses-permission
android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission
android:name="android.permission.INTERNET"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="@drawable/goo"
android:label="@string/app_name"
android:theme="@style/Translucent" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDXAFrfJnmvVqOJFQ4w5WPajngNoeZpDMI"/>
<activity
android:name="info.tekguc.umut.googlemapsmapsandroidv2.LoginActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="info.tekguc.umut.googlemapsmapsandroidv2.HelpActivity"
android:label="@string/app_name" >
</activity>
<activity
android:name="info.tekguc.umut.googlemapsmapsandroidv2.MainActivity"
android:label="@string/app_name" >
</activity>
</application>
</manifest>
在此处输入代码
请任何人帮助我如何在旧版本的android操作系统中运行此应用程序
提前感谢。首先用manifest.xml中的packagename替换
com.example.androidmapsv2
然后
除了将minSdkVersion设置为8(或9,取决于Google Play Services客户端库的版本),还可以为@Rag android使用
SupportMapFragment
,因为GPServices在Froyo之前无法工作。
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
public class SupportMapFragmentActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_support_map_fragment);
FragmentManager fmanager = getSupportFragmentManager();
Fragment fragment = fmanager.findFragmentById(R.id.map);
SupportMapFragment supportmapfragment = (SupportMapFragment)fragment;
GoogleMap supportMap = supportmapfragment.getMap();
}
}