在HTC Incredible上调用Camera.takepicture()后乱码图像

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

标签: android android-camera

通过在HTC Incredible上调用Camera.takepicture()来拍照会导致图像变得混乱。在我测试我的应用程序(Galaxy SII,Galaxy S,Nexus S)的任何其他设备上都没有出现此问题。我还没有能够自己找到解决方案......

图片关联:http://i.stack.imgur.com/j4VE8.jpg(需要更多声望才能发布)

这就是我保存imageData的方法:

    static boolean StoreByteImage(Context mContext, byte[] imageData,
        int quality, String expName) {

    File sdImageMainDirectory = new File("/sdcard");
    FileOutputStream fileOutputStream = null;
    //String nameFile;
    try {

        BitmapFactory.Options options=new BitmapFactory.Options();
        options.inSampleSize = 4;

        Bitmap myImage = BitmapFactory.decodeByteArray(imageData, 0,
                imageData.length,options);

        fileOutputStream = new FileOutputStream(
                sdImageMainDirectory.toString() +"/CapturedQRCode.jpg");

        BufferedOutputStream bos = new BufferedOutputStream(
                fileOutputStream);

        myImage.compress(CompressFormat.PNG, quality, bos);

        bos.flush();
        bos.close();

    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return true;
}

有人有提示吗?

0 个答案:

没有答案