-
Notifications
You must be signed in to change notification settings - Fork 1k
Take picture crash fix #105
base: master
Are you sure you want to change the base?
Conversation
} | ||
}); | ||
try { | ||
mCamera.takePicture(null, null, null, new Camera.PictureCallback() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about to move this callback instantiation to outside of the try/catch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestion. Could you please specify what kind of effect will this change have?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jydimir Thanks for sharing this!
It seems to me that this is simply ignoring the error rather than fixing it. |
@yaraki Agree. But it crashes in native method without any explanation about the cause. Is it possible to somehow detect the cause? |
Did this ever get fixed? At least partially? |
This is fix for my #96. I got exception every time when moved phone and took picture in the same time(as described in #96). Exception isn't verbose enough and doesn't explain the cause of exception which is originally thrown from internal native code. So to avoid app crash we can catch exception when calling
mCamera.takePicture(...)
.After adding this
try-catch
block we still get same exception and log it, but app doesn't crash and picture is actually taken.