views:

34

answers:

0

How do you add a SurfaceView showing the camera preview as the background of the BaseGameActivity of AndEngine (Physics Example).

@Override
        public Scene onLoadScene() {
                mBackgroundView = new PreviewView(this);
                addContentView(mBackgroundView, new LayoutParams(
                                LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));    // Does not work
                addContentView(mBackgroundView.getOverlay(), new LayoutParams(    
                                LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));   // Works. getOverlay() returns an ImageView.

                final Scene scene = new Scene(1);
                //scene.setBackground(new ColorBackground(0.0f, 0.0f, 0.0f, 0.0f));