本文介绍了如何显示使用API​​ V2的GoogleMap(IAM使用地图片段)在旧版本的Andr​​oid操作系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个项目,我想显示车辆在谷歌地图的位置。我正在从一个JSON Web服务纬度和车辆的经度和Diplaying标记和设置位置没有问题。

I am in a project where i want to display the location of vehicle in Google map. I am getting the latitude and longitude of the vehicles from a Json web service and no problem in Diplaying the marker and setting the location.

我的问题是应用程序正在冰淇淋砂女巫和果冻豆操作系统的手机很好,当我试图把姜饼操作系统是越来越封闭力应用。

My problem is that application is working fine on ICE CREAM SAND WITCH AND Jelly Bean OS mobiles, when i try to put the application in Gingerbread OS it is getting force closed.

在我的应用我使用的地图碎片,和API V2。
我已经加入了Android的支持v 13的jar文件到我的媒体库。

In my application i am using the Map Fragment, and API V2.I have added the android-support v 13 jar file to my library.

下面是我的清单code。

Here is my Manifest code.

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操作系统的这个应用程序。

Please any one help me how to run this application in older versions of android OS..

先谢谢了。

推荐答案

首先替换 com.example.androidmapsv2 与您的manifest.xml软件包名

First replace com.example.androidmapsv2 with your packagename in manifest.xml

然后

使用 SupportMapFragment 为&LT; 3.0版本的片段可从API 11(3.0)

use SupportMapFragment for <3.0 versions as fragment is available from API 11(3.0)

<fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment" />

和您的活动类应该看起来像这样

and your Activity class should looks like this

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();

  }

}

这篇关于如何显示使用API​​ V2的GoogleMap(IAM使用地图片段)在旧版本的Andr​​oid操作系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 13:15