Android camera onPictureTaken () the returned data does not match the preview

FYI This is not a relationship problem.

I have an application with a custom camera that works fine for all purposes and tasks, except for the following scenario.

I press the button to take a picture. Right after that I move the camera. The preview shows the correct image. The image stored on the disc is a second after that, when the camera goes off .. and is blurry.

Pressing a button calls takePicture (null, null, this);

Listener:

public void onPictureTaken(byte[] data, Camera camera) { File pictureFileDir = getTempDir(activity); //Build FileName ... String filenameOfOriginal = filename + "-original" + "." + suffix; File originalPictureFile = new File(filenameOfOriginal); try { FileUtils.writeByteArrayToFile(originalPictureFile, data); Dbg.logD(TAG, "New Image saved:" + filenameOfOriginal); } catch (IOException error) { Dbg.logD(TAG, "File" + filenameOfModified + " not saved: " + error.getMessage(), error); error.printStackTrace(); } ... } 

Any ideas?

+3
source share

Source: https://habr.com/ru/post/976617/


All Articles