Q:

How can I access getSupportFragmentManager() in a fragment?

I have a FragmentActivity and I want to use a map fragment within it.  I'm having a problem getting the support fragment manager to access it.
 if (googleMap == null) {
            googleMap = ((SupportMapFragment) getSupportFragmentManager()
                    .findFragmentById(R.id.map1)).getMap();

            // check if map is created successfully or not
            if (googleMap == null) {
                Toast.makeText(getApplicationContext(),
                        "Sorry! unable to create maps", Toast.LENGTH_SHORT)
                        .show();
            }
        }

            // create marker
            MarkerOptions marker = new MarkerOptions().position(
                    new LatLng(latitude, longitude)).title("Hello Maps ");

            CameraPosition cameraPosition = new CameraPosition.Builder()
                    .target(new LatLng(latitude, longitude)).zoom(15).build();

            googleMap.animateCamera(CameraUpdateFactory
                    .newCameraPosition(cameraPosition));

            // adding marker
            googleMap.addMarker(marker);

A:

You can directly call 
getFragmentManager() 

to get the fragment manager.
or
In your fragment, 
Create field : 
private FragmentActivity myContext;

override onAttach method of your fragment : 
@Override
public void onAttach(Activity activity) {
    myContext=(FragmentActivity) activity;
    super.onAttach(activity);
}

When you need to get Support fragment manager call : 
FragmentManager fragManager = myContext.getSupportFragmentManager(); //If using fragments from support v4

or
FragmentManager fragManager = myContext.getFragmentManager();

You are done.

A:

All you need to do is using
getFragmentManager()

method on your fragment. It will give you the support fragment manager, when you used it while adding this fragment.
Fragment Documentation

A:

Simply get it like this -
getFragmentManager() // This will also give you the SupportFragmentManager or FragmentManager based on which Fragment class you have extended - android.support.v4.app.Fragment OR android.app.Fragment.

OR
getActivity().getSupportFragmentManager();

in your Fragment's onActivityCreated() method and any method that is being called after onActivityCreated().

