Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a mutable Bitmap from ByteArray... import not working?

I'm trying to do something like this:

Bitmap bmp;
BitmapFactory.Options.inMutable = true;
bmp = BitmapFactory.decodeByteArray(data, 0, data.length);

But I'm getting an error under BitmapFactory.Options.inMutable = true;

Cannot make a static reference to the non-static field BitmapFactory.Options.inMutable

I'm sure the solution is probably something simple, but I'm unsure of why it's not working.


1 Answers

You need to create an instance of the BitmapFactory.Options class. Something like:

BitmapFactory.Options options = new BitmapFactory.Options();
options.inMutable = true;
BitmapFactory.decodeByteArray(data, 0, data.lentgh, options);
like image 183
matiash Avatar answered Oct 02 '25 04:10

matiash



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!