Android Bitmap保存为奇怪的线条

时间:2012-08-12 23:12:12

标签: android image lines htc-thunderbolt

当我保存在某些设备上拍摄的照片时,它会保存为一些奇怪的线条。我不知道如何描述这个图像的外观所以这里是:

enter image description here

我的代码在大多数设备上运行良好,但我们有两个用户使用以下设备。
1. HTC Thunderbolt
2. HTC Inspire
有人知道这是怎么回事吗?这是我的代码:

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();

        }

    }

};

感谢您的帮助......

1 个答案:

答案 0 :(得分:0)

这是因为您的设备不支持该图片,请查看此链接,在此处询问并回答

Android byte[] to image in Camera.onPreviewFrame

希望它会有所帮助!