Java から直接バイトバッファを割り当て、ビットマップから入力し、そのバッファからビットマップを作成しようとしています。しかし、結果として私はnullを受け取ります。
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
mCurrentBitmap = BitmapFactory.decodeFile(hardCodedPath, options);
// 4 - bytes count per pixel
bytesCount = mCurrentBitmap.getWidth() * mCurrentBitmap.getHeight() * 4;
pixels = ByteBuffer.allocateDirect((int) bytesCount);
mCurrentBitmap.copyPixelsToBuffer(this.pixels);
byte[] bitmapdata = new byte[pixels.remaining()];
pixels.get(bitmapdata);
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap newBitmap = BitmapFactory.decodeByteArray(bitmapdata, 0, (int) bytesCount, opt);
newBitmap が null である理由を誰かが理解するのを手伝ってくれますか?