Android 谷歌地图集成和滑动菜单

Android 谷歌地图集成和滑动菜单,android,google-maps,menu,maps,slider,Android,Google Maps,Menu,Maps,Slider,我想实现Google maps v2和jfeinstein10的SliderMenu,我设法实现了SliderMenu,但当我想在活动中添加地图时,我得到了一个错误 GoogleMap=((SupportMapFragment)getSupportFragmentManager().FindFragmentById(R.id.fragMapa))。GetMap() 在getSupportFragmentManager()中更加具体 任何解决方案都可以将两者结合起来。我把活动的代码放进去 impo

我想实现Google maps v2和jfeinstein10的SliderMenu,我设法实现了SliderMenu,但当我想在活动中添加地图时,我得到了一个错误

GoogleMap=((SupportMapFragment)getSupportFragmentManager().FindFragmentById(R.id.fragMapa))。GetMap()

在getSupportFragmentManager()中更加具体

任何解决方案都可以将两者结合起来。我把活动的代码放进去

import android.app.FragmentTransaction;
import android.os.Bundle;
import android.support.v4.app.Fragment;

import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivity;

public class ActivityPrincipal extends SlidingActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_activity_principal);

        GoogleMap mapa = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.fragMapa)).getMap();

        LatLng coordenadasGT = new LatLng(15.45368,-90.485115);
        CameraPosition camPos = new CameraPosition.Builder()
        .target(coordenadasGT)
        .zoom(8)
        .build();

        CameraUpdate camUpd = CameraUpdateFactory.newCameraPosition(camPos);

        mapa.moveCamera(camUpd);
    }

    /*
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_principal, menu);
        return true;
    }
    */

}

我成功地集成了谷歌地图v2和jfeinstein10的SliderMenu。 “我的活动”扩展了ActionBarActivity,并通过编程方式构建滑块菜单来使用它:

    public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            setContentView(R.layout.main);

            SlidingMenu menu = new SlidingMenu(this);
            menu.setMode(SlidingMenu.LEFT_OF);
            menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
            menu.setFadeDegree(0.35f);
            menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
            menu.setMenu(R.layout.options);
            menu.setShadowDrawable(R.drawable.shadow);
            menu.setShadowWidthRes(R.dimen.shadow_width);
            menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
            menu.setFadeDegree(0.35f);
            menu.setOnOpenedListener(this);

            FragmentManager fmanager = getSupportFragmentManager();
            Fragment fragment = fmanager.findFragmentById(R.id.mapView);
            SupportMapFragment supportmapfragment = (SupportMapFragment) fragment;

            mMap = supportmapfragment.getMap();
            mMap.getUiSettings().setZoomControlsEnabled(false);
            mMap.setOnMapClickListener(this);
            mMap.setOnInfoWindowClickListener(this);
            mMap.setOnMarkerClickListener(this);
            mMap.setMyLocationEnabled(true);
            mMap.setOnMyLocationChangeListener(this);
            mMap.setOnMyLocationButtonClickListener(this);
    }
mapView是我的布局中的一个片段:

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

您实际上还没有提供任何有关所遇到错误的信息。