Create a new view from a surface view
<p>I have a small application in which i implement a surface view.Now depending on some condition(time) i would like to change the screen to a different layout.How do i do this in the following code. </p>

<p>Sketch of what i am doing.</p>

<pre><code>        public class df extends Activity 
      {

      public void onCreate(Bundle savedInstanceState) {


      }

class Panel extends SurfaceView implements SurfaceHolder.Callback {

    public Panel(Context context){
        super(context);
    }

    public void onDraw(Canvas canvas) {


    }

    @Override
    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
        // TODO Auto-generated method stub
    }

    public void surfaceCreated(SurfaceHolder holder) {

    }

}

public void surfaceDestroyed(SurfaceHolder holder) {

    boolean retry = true;
    _thread.setRunning(false);
    while (retry) {
        try {
            _thread.join();
            retry = false;
        } catch (InterruptedException e) {
            // we will try it again and again...
        }
    }
}
</code></pre>

<p>}</p>
