1

Google マップ バージョン 2 を使用して簡単なマップ アプリケーションを開発しました。Android 4.0 対応デバイスでは正常に動作していますが、Android 2.3 (API 10) では動作しません。ここで、同じアプリケーションを API レベル 10 からサポートする必要があります。アプリケーション サポートを API レベル 10 から変換するにはどうすればよいですか?

私のアプリケーションは「google-play-services_lib」でサポートされています。

私のコードサンプル。

main.xml:

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

ジャバコード:

    public class MainActivity extends Activity implements LocationListener{
        private GoogleMap mMap;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
           ........
       }
}

API 10(Android 2.3)からのサポートをお願いします。

4

2 に答える 2

1

への変更

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

extends FragmentActivity

mMap =((SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map)).getMap();mMap 
于 2013-08-01T11:21:04.487 に答える