0

I just want to launch the camera activity and have it return to the calling activity. Basically I don't care about seeing the preview image where you "tap to select".

The reason for this is I'm trying to inject tap events, so I cannot get past this screen because you can't inject events into the Camera application.

rodly
  • 149
  • 3
  • 14

1 Answers1

1

Have you tried to capture the image using Camera.takePicture()? The last parameter is a callback with the bytes of the image captured. You can then create a bitmap with the byte array and save it to a file:

Bitmap image = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);

FilenameOutputStream fos = new FileOutputStream(filename);
image.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.close();

I haven't used this without a preview, but you might be able to open the camera and call takePicture() without having to use the preview.

NLam
  • 537
  • 1
  • 11
  • 25