I'm implementing a Google Maps View wrapped inside a fragment. When I try to get the ID of the `mapsView`, I get a `nullpointer` exception from `getSupportFragmentManager()`, even though my class extends `FragmentActivity`. This is my code:

MainActivity:

```
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.TabHost;
import android.widget.TabHost.OnTabChangeListener;

public class MainActivity extends Activity implements OnTabChangeListener {

private TabHost mTabHost;
private Layouts l;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Util.setMainActivty(this);

    l = new Layouts();

}

@Override
protected void onStop() {
    super.onStop();
}

@Override
public void onClick(View v) {
        l.setMapsLayout();
}
}

```

My maps\_layout fragment

```
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />

```

Layouts class:

```
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.LoaderManager;
import android.text.GetChars;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.SupportMapFragment;

public class Layouts extends FragmentActivity {

private MapView mMapView;

public void setMapsLayout() {

    MainActivity mainActivity = Util.getMainActivity();
    ViewGroup layoutContainer = (ViewGroup) mainActivity
            .findViewById(R.id.layoutContainer);
    layoutContainer.removeAllViews();

    View child1 = LayoutInflater.from(mainActivity).inflate(
            R.layout.maps_layout, null);
    layoutContainer.addView(child1);

    GoogleMap mMap = ((SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map)).getMap();

}

}

```

When I get to `getSupportFragmentManager()` its values are null. This is what I see: ![enter image description here](https://i.stack.imgur.com/13uFI.png)

Does someone know what the problem is? Thanks!