I encounter a "Caused by: java.lang.RuntimeException: Buffer not large enough for pixels " error with the following code snippit:
String pathName = "/sdcard/test.bmp";
Bitmap bm1 = BitmapFactory.decodeFile(pathName);
ShortBuffer buffer = ShortBuffer.allocate(bm1.getWidth()*bm1.getHeight());
bm1.copyPixelsToBuffer(buffer);
I thought buffer is larget enought since it is allocated according to the Bitmap's width and height. What may be cause of the problem?