I’m using PictureCallback to capture an image. And its working fine. But In HTC Desire S its not returning proper data. It returns a corrupted image like the following one

Here is the code that i used
PictureCallback cameraPictureCallbackJpeg = new PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
FileOutputStream outStream = null;
try {
// write to local sandbox file system
// outStream =
// CameraDemo.this.openFileOutput(String.format("%d.jpg",
// System.currentTimeMillis()), 0);
// Or write to sdcard
outStream = new FileOutputStream(String.format(
"/sdcard/%d.jpg", System.currentTimeMillis()));
outStream.write(data);
outStream.close();
Log.e("error", "onPictureTaken - wrote bytes: " + data.length);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
}
}
I must tell you that I’ve used other methods to convert the data into a bitmap. Thanks in advance. I’m stuck here. Any help will be appreciated.
It is because you are not using one of the supported image sizes.
Here is how you can get those.
EDIT: This is how you set the picture size: