0

When I save a picture taken on certain devices, it saves as some weird lines. I have no idea how to describe the look of this image so here it is:

enter image description here

My code works perfectly on most devices but we have had two of our users speak up with the following devices.
1. HTC Thunderbolt
2. HTC Inspire
Does anybody know how this is happening? Here is my code:

PictureCallback jpegCallback = new PictureCallback() {

    public void onPictureTaken(byte[] data, Camera camera) {
        mPreview.mCamera.startPreview();
        Log.e(TAG, "onPictureTaken - jpegCallback");

        try {
            // start camera saving system
            CameraPhoneStorageSystem camStorageSys = new CameraPhoneStorageSystem(
                    mContext);
            FileOutputStream out = null;

            String str = CameraPhoneStorageSystem
                    .returnImageNewNameForExternalMemory();
            galleryAddPic(str);

            out = new FileOutputStream(str);
            // mutableBitmap.compress(CompressFormat.JPEG, 85, out);
            out.write(data, 0, data.length);

            out.flush();
            out.close();
            out = null;
            Toast.makeText(mContext, "saved..", Toast.LENGTH_SHORT).show();

        } catch (IOException e) {
            Toast.makeText(
                    mContext,
                    "Error: Problem Saving Image.. Please check device memory",
                    Toast.LENGTH_SHORT).show();
            Log.e("saving", "problem saving images", e);

        } catch (Exception e) {
            // fail
            Log.d(TAG, "ERROR: " + e.getMessage());
        } finally {
            anyPicturesTaken = true;
            progressBar.setVisibility(View.GONE);
            snapButton.setVisibility(ImageButton.VISIBLE);
            Runtime.getRuntime().gc();

        }

    }

};

Thank you for any help...

hildred
  • 453
  • 11
  • 29

1 Answers1

0

It is because your device doesn't support that image, check this link, asked and answered here

Android byte[] to image in Camera.onPreviewFrame

Hope it would help!

Community
  • 1
  • 1
Numair
  • 1,062
  • 1
  • 20
  • 41