I want to resize a Bitmap
to store it in a HashMap
for later use.
So I do the resizing in a AsyncTask
.
final BitmapFactory.Options options = new BitmapFactory.Options();
@Override
protected Void doInBackground(byte[]... params) {
byte[] bytes = params[0];
options.inJustDecodeBounds = true;
Bitmap test = BitmapFactory.decodeByteArray(bytes,0,bytes.length,options);
int imgHeight = test.getHeight();
int imgWidth = test.getWidth();
int counter = 0;
while (imgHeight > 2000) {
imgHeight = imgHeight / 2;
counter++;
}
return null;
}
My problem is that test
is null. the bytes
is not null and has a length of 273440.
Where could be the problem?
Thank you for help!
Kind Regards!