문제

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.

도움이 되었습니까?

해결책

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);

다른 팁

inMutable is not static field. Try this:

BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inMutable = true;
BitmapFactory.decodeByteArray(data, 0, data.length(), opts);

or even better this:

Bitmap bmp;
bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
Bitmap mutableBitmap = bmp.copy(Bitmap.Config.ARGB_8888, true);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top