Blurry
Blurry copied to clipboard
Fragments
Blurry doesn't work with fragments always giving me null pointer exception
@easycheese @wasabeef @Pkmmte @JasonCromer can you help please ?
Blurry gives null pointer exception in Fragment NullPointerException: Attempt to invoke virtual method 'void android.graphics.Bitmap.recycle()' on a null object reference
Blurry.with(getContext()).radius(25).sampling(2).onto(mainLayout);
@iyashamihsan when is this happening while you are blurring the image? Is the fragment
being recreated at any point before this crash occurs?
Maybe you can share a bit more code and a larger stack trace, please.
@JasonCromer Please find below issue with fragments :
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Bitmap.recycle()' on a null object reference at jp.wasabeef.blurry.internal.Blur.of(SourceFile:42) at jp.wasabeef.blurry.Blurry$Composer.onto(SourceFile:115) ...................
while calling below,
Blurry.with(activity) .radius(40) .sampling(2) .color(ResourcesUtil.getColor(R.color.dirtyBlack25)) .onto(blurredView);
As far as I understood, the err occurs here inside of method of Blur class:
Bitmap cache = view.getDrawingCache(); cache.recycle();
Here, the drawing cache can be null sometimes. This happens when Fragments are used with BottomNavigation Bar. Fragment is removed and redrawn.
The possible solution/ workaround could be to add a null check for bitmap and then recycle.
Have similar issue, do you have good solution for this problem ?