I'm trying to take a photo with the Android camera. I need to wait 1 second or so when the program first starts so that Preview can be initiated and the photo can be taken. I did that with Handler.postDelayed and it works fine.
Now, my issue is I'd like to PAUSE the flow of the program until the run() gets executed, in which I used a while(true) loop with a flag to signal that the method has finished. However, the program freezes. There's no error returned. Can anyone shed some lights ? Below is my code
flag = false;
handler.postDelayed(new Runnable() {
public void run()
{
preview.camera.takePicture(shutterCallback, rawCallback, jpegCallback);
preview.camera.startPreview();
flag = true;
}
}, 1000);
while (true)
{
if (flag) break;
}