We could call it "Monty Python Dead Parrot Log.d answer": -P I would like for me to have a solution for you, although there are some suggestions. Heisenbugs are hard to catch.
Does the torch have an isOn () test?
Similarly (I donβt remember), does the camera have an isReady () test?
Can you tell from the magazines that the camera dies before, during, or after mCamera.torchOn () or .torchOff ()?
What happens if you extend the time interval between calls? This will not be used for a real application, but can help you monitor and track what is happening. Say something like this in pseudo code:
try { // Log.d ("cam", "here 1") ; mCamera = configAndInitialize(); // Log.d ("cam", "here 2"); if ( mCamera.isReady() ) { // or isConfigured / initialized // Log.d ("cam", "here 2"); Camera.startPreview(); // Log.d ("cam", "here 2"); thisThread.setDelay (200); // millisecs. try even up to 2000 ms ! // Log.d ("cam", "here 4"); mCamera.torchOn(); // Log.d ("cam", "here 5"); thisThread.setDelay (200); // again up to 2000 ms // Log.d ("cam", "here 6"); } } catch (Exception e) { Log.d ("oops!", e.toString() ); }
Another thing to keep track of or make sure the camera and torch are really ready before onClick can shoot. Sprinkle some delays like Log.d and take a look. You may need to call back (mCamera.isReady () and then enable onClick).
Another thing to do is see if you can dig out the source code of the camera (or torch) and GREP for error 100 - or is it a common android 100?
I am sure that you know very well how much happens when this camera lights up - it seems like hundreds of calls. Since some of these low-level elements are asynchronous (in any case, the camera is hardware), I suspect you are getting an NPE or an insufficiently initialized object. Not all NPE, etc. They fall into the trap, so he can simply die on one that would not be there if slow or synchronized sequences were used.
(HTH - I feel your pain, ari, I had to take a lot of cameras lately. Debugging on the Samsung SIII is prohibitively time consuming.)
[EDIT] You probably already found this link, but just in case:
How to enable camera flash in Android?