title: Camera.Parameters device specific crash (Samsung S3 Mini)
body: <p>The following code is working on a Galaxy Nexus, Samsung S3 and HTC One X but it crashes on a Samsung S3 Mini</p>
  
  <pre><code>@Override
  public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
      Log.d(TAG, "entering surfaceChanged");
      Camera.Parameters parameters = camera.getParameters();
      List&lt;Camera.Size&gt; previewSizes = parameters.getSupportedPreviewSizes();
  
      // set barcode scene mode
      if (parameters.getSupportedSceneModes() != null &amp;&amp; parameters.getSupportedSceneModes().contains(Camera.Parameters.SCENE_MODE_BARCODE)){
          parameters.setSceneMode(Camera.Parameters.SCENE_MODE_BARCODE);
          Log.d(TAG, "setting parameters.setSceneMode(Camera.Parameters.SCENE_MODE_BARCODE)");
      }
  
  
      Camera.Size size = previewSizes.get(0);
      if (previewSizes.size() &gt; 2)
          size = previewSizes.get(2);
      else if (previewSizes.size() &gt; 1)
          size = previewSizes.get(1);
  
      parameters.setPreviewSize(size.width, size.height);
      Log.d(TAG, "picsize w: " + Integer.toString(size.width) + " h: " + Integer.toString(size.height));
      if (Build.VERSION.SDK_INT &gt; Build.VERSION_CODES.HONEYCOMB_MR2) {
          parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
          Log.d(TAG, "setting .setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)");
      } else {
          parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
          Log.d(TAG, "setting .setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)");
      }
  
      // setup cam flash mode
      if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FLASH_MODE_AUTO)){
          parameters.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO);
          Log.d(TAG, "setting .setFlashMode(Camera.Parameters.FLASH_MODE_AUTO)");
      }
  
      int maxZoom = parameters.getMaxZoom();
      int zoom = (int) Math.floor(maxZoom / 3);
      if (parameters.isZoomSupported()) {
          if (zoom &gt;= 0 &amp;&amp; zoom &lt; maxZoom) {
              parameters.setZoom(zoom);
              Log.d(TAG, "setting .setZoom(" + Integer.toString(zoom) +")");
          } else {
              // zoom parameter is incorrect
              Log.d(TAG, "setting no zoom");
          }
      }
      camera.setParameters(parameters);
      camera.startPreview();
  }
  </code></pre>
  
  <p>Log Output:</p>
  
  <pre><code>8   05-13 10:54:45.864 D/CameraSurfaceView(11784): entering surfaceChanged
  9   05-13 10:54:45.874 D/CameraSurfaceView(11784): picsize w: 800 h: 480
  10  05-13 10:54:45.874 D/CameraSurfaceView(11784): setting .setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)
  11  05-13 10:54:45.874 D/CameraSurfaceView(11784): setting .setFlashMode(Camera.Parameters.FLASH_MODE_AUTO)
  12  05-13 10:54:45.874 D/CameraSurfaceView(11784): setting .setZoom(10)
  13  05-13 10:54:45.914 D/AndroidRuntime(11784): Shutting down VM
  14  05-13 10:54:45.914 W/dalvikvm(11784): threadid=1: thread exiting with uncaught exception (group=0x411422a0)
  </code></pre>
  
  <p>StackTrace:</p>
  
  <pre><code>java.lang.RuntimeException: setParameters failed
  at android.hardware.Camera.native_setParameters(Native Method)
  at android.hardware.Camera.setParameters(Camera.java:1452)
  at com.getznap.znap.CameraSurfaceView.surfaceChanged(CameraSurfaceView.java:103)
  at android.view.SurfaceView.updateWindow(SurfaceView.java:602)
  at android.view.SurfaceView.access$000(SurfaceView.java:81)
  at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:173)
  at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:707)
  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1944)
  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1113)
  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4481)
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
  at android.view.Choreographer.doCallbacks(Choreographer.java:555)
  at android.view.Choreographer.doFrame(Choreographer.java:525)
  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
  at android.os.Handler.handleCallback(Handler.java:615)
  at android.os.Handler.dispatchMessage(Handler.java:92)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:4867)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>I'd guess that the S3 mini has a problem with one of my camera parameters. I dont't own a S3 Mini so I can't test all parameters one by one. Is there any obvious error in my code?</p>