Reputation: 13
Greetings. I am new to Android and haven't touched Java in a long time.
I'm working on an app specifically for the Nexus S with Android 2.3.1. I would like the app to take several photos quickly with little user input. At the moment I would like to be able to get 10 images from the camera as quickly as possible. In my code I have takePicture() being started like so:
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 info. Thanks in advance.
Upvotes: 1
Views: 4373
Reputation: 40401
It is probably trying to take the second picture while taking the first one, and dismissing it. Wait a second or so between each takePicture() call. Or, much better, use the pictureCallback to fire the second takePicture()
Upvotes: 3