On Wednesday, 18 March 2015 04:00:31 UTC-7, Sean Owen wrote:
> That seems like a bug, like the manual camera ID should be set earlier. Can you try that? if it works, feel free to open a PR against the open source project to fix that.
Okay I was able to changing the order of these operations and it did fix this particular bug. Though I cannot say with confidence this won't cause other potential bugs with different use. I ran mvn package after the changes which I believe runs the tests and it was successful. I forked the repo made the following changes and am going to submit a pull request if that is alright.
Moved the following code to the end of the onResume method in CaptureActivity.java:
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
SurfaceHolder surfaceHolder = surfaceView.getHolder();
if (hasSurface) {
// The activity was paused but not stopped, so the surface still exists. Therefore
// surfaceCreated() won't be called, so init the camera here.
initCamera(surfaceHolder);
} else {
// Install the callback and wait for surfaceCreated() to init the camera.
surfaceHolder.addCallback(this);
}
Thanks,
Nathan