I want to have a separate class from MainActivity for initializing map and have static method for initializing so it remains same across project and any class can use this googlemap object returning from class, I wrote a separate class 

```
public class MapFragment extends AppCompatActivity{

public static SupportMapFragment mapFrag;

public static SupportMapFragment GetMapObj() {
   mapFrag = (SupportMapFragment) new MainActivity().
   getSupportFragmentManager().findFragmentById(R.id.frag_map);
}

```

And in MainActivity using it like this

```
SupportMapFragment mapFragment = MapFragment.GetMapObj();
        mapFragment.getMapAsync(this);

```

I have 2 xml 1 for the class above and 1 for mainActivity I dnt know where should I put my 

```
 <fragment
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/frag_map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    tools:context="com.example.sarahn.clientapimap.MainActivity"
    />

```

And having said all this my application crashing on null pointer exception that attempt to invoke getAsncMap on null object reference

}