title: Show my Layout while SurfaceView is loading Camera Preview
body: <p>I have a simple screen with a start button. When the Start button is pressed, I want to go to a new Screen with a SurfaceView to show the Camera in.</p>
  
  <p>Everything works fine, but the Camera takes a while to load, and this gives me a black screen.
  I would like the new layout to load. And than start the camera after it has been loaded...</p>
  
  <p>Therefor, I do all Camera loading in a background thread, but still, I get a black screen...
  Here's my layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout android:id="@+id/RelativeLayout1"
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@drawable/blue_bg"&gt;
  
      &lt;SurfaceView
          android:id="@+id/surface_camera"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:layout_marginLeft="25dp"
          android:layout_marginRight="25dp"
          android:layout_below="@id/scan_header"
          android:layout_above="@id/scan_footer"&gt;
      &lt;/SurfaceView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Here is the method from my Activity, which loads the new view:</p>
  
  <pre><code>private void setContent()
  {
      setContentView(R.layout.scan)
  
      Thread t = new Thread()
      {
          public void run()
          {
  
              final SurfaceView mSurfaceView = (SurfaceView)findViewById(R.id.surface_camera);
              final SurfaceHolder mSurfaceHolder = mSurfaceView.getHolder();
  
              try
              {   
                  cameraView = new CameraView();
                  mSurfaceHolder.addCallback(cameraView);
                  cameraView.setPictureListener(SunpluggedActivity.this);
                  mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  
              } catch(Exception e)
              {
                  Log.d(TAG, "Another exception");
                  e.printStackTrace();
              }
          }
      };
      t.start();
  }
  </code></pre>
  
  <p>How come, the new layout is not shown, until the thread has finished loading the camera?</p>
  
  <p>EDIT: I've tried Thread.sleep(200) within the Thread to sleep for some time... When I do that, the new Layout is shown immedeately, but the Camera never starts...</p>