【问题标题】:The method decodeByteArray(byte[], int, int) in the type BitmapFactory is not applicable for the arguments (byte[][], int, int)BitmapFactory 类型中的方法 decodeByteArray(byte[], int, int) 不适用于参数 (byte[][], int, int)
【发布时间】:2014-12-16 09:54:11
【问题描述】:

我将它放在 AsyncTask 中,但出现此错误。

BitmapFactory 类型中的方法 decodeByteArray(byte[], int, int) 不适用于参数(byte[][], int, int)

private class SaveImageTask extends AsyncTask<byte[], Void, Void>{

    @Override
    protected Void doInBackground(byte[]... params) {
        // TODO Auto-generated method stub
        Bitmap bitmapPicture = BitmapFactory.decodeByteArray(params, 0,params.length);

        return null;
    }


    }

}

【问题讨论】:

  • 为什么要发送 byte[][] ?你应该有一个一维字节数组来引用图像。我认为您应该发送参数 [0]。它只是异步任务模式。第二维是指参数的数量。它接受多个参数。如果你只发送 params[] 到那个,你可以用 byte[0] 调用它。
  • 很可能,Jason 的解决方案会奏效

标签: java android canvas bitmap camera


【解决方案1】:

我认为你需要:

Bitmap bitmapPicture = BitmapFactory.decodeByteArray(params[0], 0,params[0].length);

params 本身是一个数组,因此您需要指定一个索引。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-16
    • 2018-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-06
    • 2014-10-08
    • 1970-01-01
    相关资源
    最近更新 更多