假设下面的伪代码
my_camera.takePicture(...)
Waiting call back ends
my_camera.release()
Manipulate picture
我不知道如何实现“等待回叫”等待等待拍摄照片的行。所以我想按如下方式实现它。在回电中:
PictureCallback myPictureCallback_JPG = new PictureCallback(){
@Override
public void onPictureTaken(byte[] arg0, Camera arg1) {
Bitmap bitmapPicture = BitmapFactory.decodeByteArray(arg0, 0, arg0.length);
picture_taken = true;
}};
然后上面的伪代码变成:
picture_taken = false;
my_camera.takePicture(...)
while (!picture_taken) ;
my_camera.release()
Manipulate picture
这样做是否正确?