title: Application works on android 2.2, but not on 2.3
body: <p>I wanna write a kind of camera application which uses real-time preview from camera displayed on SurfaceView, another layer above preview is a mask (funny picture etc.). The function to take a picture on display click. The issue is that the application works on adroid 2.2 just fine but does NOT work on 2.3 (using phone and emulator). I have premission for camera in Mainfest.</p>
  
  <p>Here is my activivty:</p>
  
  <pre><code>package funny.camera;
  
  import android.app.Activity;
  import android.content.pm.ActivityInfo;
  import android.hardware.Camera;
  import android.hardware.Camera.PictureCallback;
  import android.hardware.Camera.ShutterCallback;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.SurfaceHolder;
  import android.view.SurfaceView;
  import android.view.View;
  import android.view.ViewGroup.LayoutParams;
  
  public class CameraActivity extends Activity{
  
      private CamScreen cam;
      private LayoutInflater controlInflater = null;
      SurfaceView surfaceView;
      SurfaceHolder surfaceHolder;
      View touchscreen;
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          cam = new CamScreen(this);
  
          setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); 
  
          setContentView(R.layout.camscreen);
  
          surfaceView = (SurfaceView)findViewById(R.id.camerapreview);
          surfaceHolder = surfaceView.getHolder();
          surfaceHolder.addCallback(cam);
          surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);     
  
          controlInflater = LayoutInflater.from(getBaseContext());
  
          View viewControl = controlInflater.inflate(R.layout.camoverlay, null);
          LayoutParams layoutParamsControl = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
          addContentView(viewControl, layoutParamsControl);
          View viewTouch = controlInflater.inflate(R.layout.camtouch, null);
          addContentView(viewTouch, layoutParamsControl);  
  
          viewControl.setOnClickListener(new View.OnClickListener() {         
              @Override
              public void onClick(View v) {
                  cam.camera.takePicture(shutterCallback, rawCallback, jpegCallback);
              }
          });
      }
      ShutterCallback shutterCallback = new ShutterCallback(){
  
          @Override
          public void onShutter() {
  
          }};
  
      PictureCallback rawCallback = new PictureCallback(){
  
          @Override
          public void onPictureTaken(byte[] arg0, Camera arg1) {
  
          }};
  
      PictureCallback jpegCallback = new PictureCallback(){
  
          @Override
          public void onPictureTaken(byte[] _data, Camera _camera) {
  
          }};
  }
  </code></pre>
  
  <p>And the classrelated to the camera preview</p>
  
  <pre><code>public class CamScreen extends SurfaceView implements SurfaceHolder.Callback {
  
      //SurfaceHolder sHolder;
      //SurfaceView surfaceView;
      Camera camera;
  
      CamScreen(Context context) {
      super(context);    
      }
  
      public void surfaceCreated(SurfaceHolder holder) {
          // Open the camera and start viewing    
          camera = Camera.open();
  
          try {
             camera.setPreviewDisplay(holder);
          } catch (IOException exception) {
              camera.release();
              camera = null;
          }
      }
  
      public void surfaceDestroyed(SurfaceHolder holder) {
          // Kill all our crap with the surface
          camera.stopPreview();
          camera.release();
          camera = null;
      }
  
      public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
          // Modify parameters to match size.
          Camera.Parameters params = camera.getParameters();
          params.setPreviewSize(w, h);
          params.setPictureFormat(PixelFormat.JPEG);
          camera.setParameters(params);
  
          camera.startPreview();
      }
  }
  </code></pre>
  
  <p>Any ideas what is wrong? I thought taht if application works on older android version it works on the new one as well.</p>
  
  <p>Thank you</p>