I was using camera.setPreviewCallback and my program was crashing sometimes when using AutoFocus or TakePicture. I found that if you disable the PreviewCallback (set to null) before calling AutoFocus or TakePicture, it does not happen nearly as often.
For the few times it still happened, I noticed in LogCat there were debug messages saying "dataCallback" even after I set it to null. These wouldn't stop right way, sometimes not until a full second later. Almost every time the dataCallback messages kept going while AutoFocusing, the program would crash. I found that by using camera.setOneShotPreviewCallback instead, then calling it again at the end of your PreviewCallback handler, you can have much more control over when the callbacks stop. Before AutoFocus or TakePicture start, simply trip a flag that disables calling setOneShotPreviewCallback at the end of your handler. This will immediately disable the callback before AutoFocus or TakePicture start. Hasn't crashed since. This has been a thorn in my side for quite a while and I know a lot of people have given up on their Camera apps because of this issue and similar. Thought I would share what worked for me. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---