Android 2.3.1 Camera takePicture () Multiple images at the click of a button

Hey. I am new to Android and have not touched Java for a long time.

I am working on an application specifically for the Nexus S with Android 2.3.1. I would like the application to quickly take a few photos with few user inputs. At the moment, I would like to get 10 images from the camera as quickly as possible. In my code, I acceptPicture () runs as follows:

takepicture = (Button) findViewById(R.id.button); // created button from main.xml takepicture.setOnClickListener(new OnClickListener(){ // creating useful button public void onClick(View view){ mCamera.takePicture(mShutterCallback,mPictureCallback,mjpeg); // when clicked take picture } }); 

This works for one image per click, which is saved using

 PictureCallback mjpeg = new PictureCallback() { // for compressed picture data public void onPictureTaken(byte[],data, Camera c { /*Saving image to internal sd card*/ } 

I tried putting takePicture () in a for loop, but that didn't work. Any suggestions? Please let me know if you need more information. Thanks in advance.

+1
source share
1 answer

He is probably trying to take a second photograph by taking the first and reject it. Wait a few seconds between each call to takePicture (). Or, which is much better, use pictureCallback to run the second takePicture ()

+3
source

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


All Articles