3

i have problems with this, recently i have also problem with just taking 1 photo... do you know how to solve it? any working code?

i'm doing it like that:

            mCamera = Camera.open();
    Log.e(TAG, "onCreate");
    mCamera.takePicture(null, mPictureCallback, mPictureCallback);

            Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
    public void onPictureTaken(byte[] imageData, Camera c) 
    {
        if (imageData != null) {
            //process photo
        }               
        }
};

in onDestroy() i release the camera

on simulator it works, on telephone - 1st time runs without problems but no picture, second and next times - 'force close' - looks like camera is not released ...

questioner
  • 2,283
  • 3
  • 26
  • 35
  • Aside from the fact you're taking the photo immediately after opening the camera, why are you re-declaring mPictureCallback? Also, you should release the camera in onPause(), not onDestroy(). Anyway, run adb logcat in the command prompt and check what exception is being called when it force closes. – HXCaine May 25 '10 at 21:04
  • ok, i'm repairing all that mistakes but i'm going t take pictures in service, not in activity - there is no 'onPause()' – questioner May 25 '10 at 21:22
  • ok, i will do this in activity. How can i debug it on the phone? in simulator it works as a dream. – questioner May 25 '10 at 21:36
  • possible duplicate of [How to make burst mode available to Camera](http://stackoverflow.com/questions/6889271/how-to-make-burst-mode-available-to-camera) – Alex Cohn Nov 17 '14 at 19:12

0 Answers0