Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Take picture crash fix #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Take picture crash fix #105

wants to merge 1 commit into from

Conversation

andreilisun
Copy link

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.

}
});
try {
mCamera.takePicture(null, null, null, new Camera.PictureCallback() {

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?

Copy link
Author

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?

Copy link

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!

@yaraki
Copy link
Contributor

yaraki commented Mar 13, 2017

It seems to me that this is simply ignoring the error rather than fixing it.

@andreilisun
Copy link
Author

andreilisun commented Mar 13, 2017

@yaraki Agree. But it crashes in native method without any explanation about the cause. Is it possible to somehow detect the cause?

@minsik-ai
Copy link

Did this ever get fixed? At least partially?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants