Code example for FragmentActivity

Methods: onCreate, setContentView

0
        return R.layout.map; 
    } 
 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId()); 
        setUpMapIfNeeded(); 
    } 
 
    @Override 
    protected void onResume() { 
        super.onResume(); 
        setUpMapIfNeeded(); 
    } 
 
    private void setUpMapIfNeeded() { 
        if (mMap != null) {
            return; 
        } 
        mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();