title: OnPreviewFrame data image to imageView
body: <p>i'm trying to get the byte[] from the preview of the camera, convert it to bitmap and display it on a imageview with imageView.setImageBitmap()</p>
  
  <p>i've managed to start the preview and display it on a surfaceView, but i don't know how to convert the byte[] data (that comes in Yuv format i think) in a RGB bitmap to display it on a imageView.</p>
  
  <p>the code i'm trying is the following:</p>
  
  <pre><code>camera = camera.open();
  parameters = camera.getParameters();
  camera.setParameters(parameters);
  surfaceHolder = surfaceView.getHolder();
  surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  camera.setPreviewDisplay(surfaceHolder);
  camera.setPreviewCallback(this);
  camera.startPreview();
  </code></pre>
  
  <p>and the preview callback is this</p>
  
  <pre><code>@Override
  public void onPreviewFrame(byte[] data, Camera camera) {
  
      Camera.Parameters parameters = camera.getParameters();
      int width = parameters.getPreviewSize().width;
      int height = parameters.getPreviewSize().height;
      ByteArrayOutputStream outstr = new ByteArrayOutputStream();
      Rect rect = new Rect(0, 0, width, height); 
      YuvImage yuvimage=new YuvImage(data,ImageFormat.NV21,width,height,null);
      yuvimage.compressToJpeg(rect, 100, outstr);
      Bitmap bmp = BitmapFactory.decodeByteArray(outstr.toByteArray(), 0, outstr.size());
      imgView1.setImageBitmap(bmp);        
  }
  </code></pre>
  
  <p>The preview works but the imageView remains empty</p>
  
  <p>Any idea?</p>