안녕하세여.

이제 막 안드로이드 길을 걸어가려는 초보입니다.

혼자 스터디하려니 막히는 부분이 한두군데가 아니네여...ㅠㅠ

교제에 있는 예제를 하나씩 테스트 해보고있는데

갤럭시s에서 화면이 세로로 볼때 가로보기가 나옵니다.

그래서 가로돌려보면 화면이 멈춘 후 잠시후 강제종료됩니다...ㅠㅠ

public class Camera2 extends Activity implements SurfaceHolder.Callback
{
    private Camera camera;
    private boolean isPreviewRunning = false;
    private SimpleDateFormat timeStampFormat = new SimpleDateFormat("yyyyMMddHHmmssSS");
   
    private SurfaceView surfaceView;
    private Button bt1;
    private SurfaceHolder surfaceHolder;
    private Uri targetResource = Media.EXTERNAL_CONTENT_URI;

    public void onCreate(Bundle icicle)
    {
        super.onCreate(icicle);
        Log.e(getClass().getSimpleName(), "onCreate");
        getWindow().setFormat(PixelFormat.TRANSLUCENT);
        setContentView(R.layout.main);
        surfaceView = (SurfaceView)findViewById(R.id.surface);
        surfaceHolder = surfaceView.getHolder();
        surfaceHolder.addCallback(this);
        surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    }

    public boolean onCreateOptionsMenu(android.view.Menu menu) {
        MenuItem item = menu.add(0, 0, 0, "View Pictures");
        item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
            public boolean onMenuItemClick(MenuItem item) {
                Intent intent = new Intent(Intent.ACTION_VIEW, targetResource);
                startActivity(intent);
                return true;
            }
        });
       
        return true;
    }
    protected void onRestoreInstanceState(Bundle savedInstanceState)
    {
        super.onRestoreInstanceState(savedInstanceState);
    }
   
  
    Camera.PictureCallback mPictureCallbackRaw = new Camera.PictureCallback() {
        public void onPictureTaken(byte[] data, Camera c) {
            camera.startPreview();
        }
    };
   

    Camera.ShutterCallback mShutterCallback = new Camera.ShutterCallback() {
     public void onShutter() {
     }
    };
   
    public boolean onKeyDown(int keyCode, KeyEvent event)
    {
     ImageCaptureCallback camDemo = null;
      
//        //파일저장
//     if(keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
//     try {
//      String filename = timeStampFormat.format(new Date());
//      ContentValues values = new ContentValues();
//      values.put(Media.TITLE, filename);
//      values.put(Media.DESCRIPTION, "Image from Android Emulator");
//      Uri uri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);
//      camDemo = new ImageCaptureCallback( getContentResolver().openOutputStream(uri));
//     } catch(Exception ex ){
//      }
//     }
       
//     //카메라끄기
//        if (keyCode == KeyEvent.KEYCODE_BACK) {
//            return super.onKeyDown(keyCode, event);
//        }
 
        //사진찍기 and 저장.
        if (keyCode == KeyEvent.KEYCODE_BACK) {
         
         //사진찍기
            camera.takePicture(mShutterCallback, mPictureCallbackRaw, camDemo);
           
            //사진저장 시작
            String filename = timeStampFormat.format(new Date());
      ContentValues values = new ContentValues();
      values.put(Media.TITLE, filename);
      values.put(Media.DESCRIPTION, "Image from Android Emulator");
      Uri uri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);
      try {
    camDemo = new ImageCaptureCallback( getContentResolver().openOutputStream(uri));
   } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
   //사진저장 끝
   
            return true;
        }

        return false;
    }

    protected void onResume()
    {
        Log.e(getClass().getSimpleName(), "onResume");
        super.onResume();
    }

    protected void onSaveInstanceState(Bundle outState)
    {
        super.onSaveInstanceState(outState);
    }

    protected void onStop()
    {
     super.onStop();
    }
    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h)
    {
        if (isPreviewRunning) {
            camera.stopPreview();
        }
        Camera.Parameters p = camera.getParameters();
        p.setPreviewSize(w, h);
        camera.setParameters(p);
        try {
   camera.setPreviewDisplay(holder);
  } catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
        camera.startPreview();
        isPreviewRunning = true;
    }
    public void surfaceCreated(SurfaceHolder holder)
    {
     camera = Camera.open();
    }

    public void surfaceDestroyed(SurfaceHolder holder)
    {
        camera.stopPreview();
        isPreviewRunning = false;
        camera.release();
    }
}

현재 제가 적용한 소스구요...초짜라 어디가 문제인지를 잘 모르겠네요...

고수님들 도와주세여~!!ㅠㅠ아니면 혹시 참고할만한 블로그나 게시글 좀 없을까요...

암만 검색해봐도 안나오네여...부탁드립니다~!!