title: converting Java bitmap to byte array
body: <pre><code>  Bitmap bmp   = intent.getExtras().get("data");
    int size     = bmp.getRowBytes() * bmp.getHeight();
    ByteBuffer b = ByteBuffer.allocate(size);
  
    bmp.copyPixelsToBuffer(b);
  
    byte[] bytes = new byte[size];
  
    try {
       b.get(bytes, 0, bytes.length);
    } catch (BufferUnderflowException e) {
       // always happens
    }
    // do something with byte[]
  </code></pre>
  
  <p>When I look at the buffer after the call to <code>copyPixelsToBuffer</code> the bytes are all 0... The bitmap returned from the camera is immutable... but that shouldn't matter since it's doing a copy. </p>
  
  <p>What could be wrong with this code?</p>