diff options
| author | dswitkin@google.com <dswitkin@google.com@59b500cc-1b3d-0410-9834-0bbf25fbcc57> | 2011-05-20 19:19:44 +0400 |
|---|---|---|
| committer | dswitkin@google.com <dswitkin@google.com@59b500cc-1b3d-0410-9834-0bbf25fbcc57> | 2011-05-20 19:19:44 +0400 |
| commit | d6435a3b791906efbe076819385ff00ca75b7685 (patch) | |
| tree | dae778cf84dae20f6714dc3db28111c7acc34586 | |
| parent | 3aee66c0f1a27f72eeb014af1ecd2d8752825a50 (diff) | |
| download | zxing-android-embedded-d6435a3b791906efbe076819385ff00ca75b7685.tar.xz | |
Caught RuntimeException for Camera.startPreview() and put up an error message. We were getting 135 reports a week about this.
git-svn-id: http://zxing.googlecode.com/svn/trunk/android@1788 59b500cc-1b3d-0410-9834-0bbf25fbcc57
| -rwxr-xr-x | src/com/google/zxing/client/android/CaptureActivity.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/com/google/zxing/client/android/CaptureActivity.java b/src/com/google/zxing/client/android/CaptureActivity.java index 4cbaf7c7..fbc7891c 100755 --- a/src/com/google/zxing/client/android/CaptureActivity.java +++ b/src/com/google/zxing/client/android/CaptureActivity.java @@ -604,19 +604,18 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal private void initCamera(SurfaceHolder surfaceHolder) { try { CameraManager.get().openDriver(surfaceHolder); + // Creating the handler starts the preview, which can also throw a RuntimeException. + if (handler == null) { + handler = new CaptureActivityHandler(this, decodeFormats, characterSet); + } } catch (IOException ioe) { Log.w(TAG, ioe); displayFrameworkBugMessageAndExit(); - return; } catch (RuntimeException e) { // Barcode Scanner has seen crashes in the wild of this variety: // java.?lang.?RuntimeException: Fail to connect to camera service Log.w(TAG, "Unexpected error initializating camera", e); displayFrameworkBugMessageAndExit(); - return; - } - if (handler == null) { - handler = new CaptureActivityHandler(this, decodeFormats, characterSet); } } |
