My picture taking is in the image processing thread, not in the UI
thread, so an asynchronous takePicture() has no benefit for
responsiveness. To me it is just a nuisance actually, and the fact
that its asynchronous functioning is not documented made matters
worse. I didn't try the Handler approach: thanks for the suggestion,
Jose. It might be a little more elegant, but my processing thread has
nothing else to do but wait until the picture is taken before it can
process that picture, so letting it sleep and poll semaphores every
few tenths of a second works just as well for me, I think. I have no
data yet on how long a G1 needs for taking a still image, and if it is
more than a few seconds I might indeed add a progress bar.

On Oct 30, 1:08 pm, qvark <[EMAIL PROTECTED]> wrote:
> I think this is a good decision to keep the applications "responsive".
> This way you could show a progress bar or something similar right
> after the call to the takePicture() method.
>
> > I could not find any
> > documentation about a Listener for completion of snapshot-taking, so
> > to fix things I now had to add my own semaphores and a while-sleep to
> > make sure my snapshot is taken and processed before I reuse the bitmap
> > in which I store the onPictureTaken() data.
>
> Why don't you send a message to a Handler (http://code.google.com/
> android/reference/android/os/Handler.html) when your processing in the
> onPictureTaken() is finished? When you receive that message you could
> remove the progress bar and your picture would be ready to use.
>
> Cheers,
>
> Jose Luis.
>
> On 29 oct, 14:22, blindfold <[EMAIL PROTECTED]> wrote:
>
> > After getting unexpected results from takePicture() and subsequent
> > image processing, I discovered that takePicture() is asynchronous.
> > Although the documentation indeed states that takePicture() (just?)
> > registers a callback,
>
> >http://code.google.com/android/reference/android/hardware/Camera.html
>
> > thereby suggestive of some other method to take the actual snapshot
> > (but such a method does not exist), takePicture() also doubles as a
> > trigger to actually take the snapshot, *but* asynchronously with the
> > code in which takePicture() is called. To me this seems highly
> > confusing at best, if not plain ugly. I could not find any
> > documentation about a Listener for completion of snapshot-taking, so
> > to fix things I now had to add my own semaphores and a while-sleep to
> > make sure my snapshot is taken and processed before I reuse the bitmap
> > in which I store the onPictureTaken() data.
>
> > Regards
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Android Discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/android-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to