@Override public void onClick(View v) { // TODO Auto-generated method stub if (v == shotBtn) { camera.takePicture(null, null, null, this); } } @Override public void onPictureTaken(byte[] ByteImg, Camera camera) { // TODO Auto-generated method stub addImg(ByteImg); } public void addImg(byte[] ByteImg) { ByteArrayInputStream imageStream = new ByteArrayInputStream(ByteImg); Bitmap theImage = BitmapFactory.decodeStream(imageStream); img.setImageBitmap(theImage); camera.startPreview(); } 

But in img nothing is recorded, the image is simply cleared (or deleted, but unlikely). What have I done wrong?

    1 answer 1

    According to your piece of code, you did not clearly initialize the camera or not, read the link, there is a worker code there. Working with the camera in Android

    • I told you that there is no image after taking a photo. I have already initialized the camera. - Mr-Al