本文介绍了安卓2.3.1相机takePicture()多张影像一键点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候。我是新来的Andr​​oid并没有触及的Java在很长一段时间。

Greetings. I am new to Android and haven't touched Java in a long time.

我工作的一个应用程序专为Nexus S的采用Android 2.3.1。我想应用程序采取多张照片快速很少的用户输入。目前,我想是能够得到10幅图像从相机尽快。在我的code我已经takePicture()被启动,像这样:

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*/ }

我试图把的 takePicture()的在for循环中,但没有奏效。有什么建议么?请让我知道如果你需要更多的信息。先谢谢了。

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.

推荐答案

这可能是试图把第二张图片,同时将第一位的,贬。等待一秒钟左右各takePicture()调用之间。或者,更好,使用pictureCallback火灾第二takePicture()

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()

这篇关于安卓2.3.1相机takePicture()多张影像一键点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 00:55