I have a Sony xperia Z with android 4.4.2 in which I have an app that can take photos.
It has a TextureView for previewing, so I have a line saying
camera.setPreviewTexture(preview_texture_view.getSurfaceTexture());
then later...
camera.startPreview();
The app now displays a continuous preview of what the camera sees. I can then press a button and the following gets executed:
camera.takePicture(mShutterCallback, mPictureCallbackRaw, this);
A picture is taken, and saved. Also the previewing is still active (which is exactly what I want).
All well and good so far. But the problem occurs when I try and run the exact same app on a prototype device I have, which is running Android 4.3. I see the preview ok, and when I press my button, the photo is taken and saved ok. But the preview is now frozen. The program has not crashed. takePicture() returned without any exception.
My suspicion was that perhaps, in different versions of Android it may be defined behaviour that takePicture() somehow resets(?) the camera after it is done - perhaps it is some design change that made between 4.3 and 4.4.1, or perhaps different hardware could make a difference.
Has anyone come across a similar issue? If so how was it solved?
EDIT: I tried putting camera.startPreview(); inside the onPictureTaken method of my PictureCallback, but it immediately crashes with: RuntimException startPreview failed.