I've built an application that switches between two screens - a LinearLayout and a SurfaceView - via the application.setContentView() method.
When switching between the two screens, the surface of the SurfaceView gets destroyed, and never created new again. Here is what I do: During my application, I switch between the two screens via calling setContentView() from my application. My SurfaceView starts a thread that renders the view, once the surface is created. This works fine the first time I'm doing this: 1. Create the SurfaceView 2. Get a handle of the surfaceHolder, and add my SurfaceView as a surfaceHolder callback 3. Call setContentView(SurfaceViewScreen) from my app, to bring the SurfaceView screen to the front This now nicely calls onSurfaceCreated() in my SurfaceView. Based on a user action, I later call setContentView(Layout) to display my standard Layout again. This nicely calls the onSurfaceDestroyed() mehod of my SurfaceView. The problem is now, that if I change back again to the SurfaceView via calling application.setContentView(SurfaceView), the surface never gets re-created, i.e. neither does onSurfaceCreated() get called, nor does my view render correctly, as in the according thread surfaceHolder.getCanvas() returns null. What am I doing wrong? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

