Error : Immutable bitmap passed to Canvas constructor

I pass the image from drawable reference like follows

Bitmap bitmap = mImageGenerator.generateDateImage(calendar, R.drawable.data);

it throws

java.lang.IllegalStateException: Immutable bitmap passed to Canvas constructor

I use same exact statement in other activity and it works fine.

Problem :

mImageGenerator.generateDateImage is locked class from caldroid (https://github.com/roomorama/Caldroid)

so cant change anything in it.

I just noticed that this occurs on NOUGAT How do I solve this issue?

Upvotes: 2

Views: 4797

Answers (1)

So the solution is to add

BitmapFactory.Options options = new BitmapFactory.Options();
        options.inScaled = false;
        options.inMutable = true;<<<<<<

in custom created class ownImageGenerator

Upvotes: 1

Related Questions