How to initialise an extended AppStateManager's state

I have created an AppStateManager class so I can override the cleanup method

import com.jme3.app.Application;
import com.jme3.app.state.AppStateManager;

public class MyAppStateManager extends AppStateManager {
    
    public MyAppStateManager (Application app) {
        
        super (app);
    }
    
    @Override
    public void cleanup () {
        
        super.cleanup();
        
        /*
           my clean up stuff
        */
    }
}

and I assume it’s ok to reassign stateManager like this:

@Override
public void simpleInitApp() {
   :
   :
   stateManager = new MyAppStateManager(app);
   : 
   :
}

my app runs lovely, however these SimpleApplication methods believe
stateManager.getState(StatsAppState.class) == null

which prevents me from displaying stats

public void setDisplayFps(boolean show) {
   if (stateManager.getState(StatsAppState.class) != null) {
      stateManager.getState(StatsAppState.class).setDisplayFps(show);
   }
}

public void setDisplayStatView(boolean show) {
   if (stateManager.getState(StatsAppState.class) != null) {
      stateManager.getState(StatsAppState.class).setDisplayStatView(show);
   }
}

Is it possible to initialise (my) stateManager’s state?

Best regards

Why on earth would you want to do this?!?

Put another way, there is nothing you can do here that couldn’t be done better somewhere else… the entire attempt is a bit misguided.

Obviously, if you replace the state manager after the original has already been created and initialized then the new one will be missing stuff.

To answer your unasked question, you do cleanup() in an app states cleanup (best way) or as part of the application’s cleanup.