0

假设下面一段伪代码

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

以这种方式进行是否正确?

4

0 回答 0