CameraKit / blurkit-android

The missing Android blurring library. Fast blur-behind layout that parallels iOS.
MIT License
3.72k stars 309 forks source link

Cannot initialize component dynamically #66

Open stellio-team opened 4 years ago

stellio-team commented 4 years ago

I get crash when try to create blurView dynamically. Look at the code - this contructor is useless. Just replace super with this and it will work without crash.

public BlurLayout(Context context) { super(context, (AttributeSet)null); this.invalidationLoop = new NamelessClass_1(); }

What crash I get:

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setImageBitmap(android.graphics.Bitmap)' on a null object reference at io.alterac.blurkit.BlurLayout.invalidate(BlurLayout.java:166)

MartinNovak1991 commented 3 years ago

Same problem ... If BlurLayout is created programatically system throws this error.

Issue fixed if I used this constructor

blured=new BlurLayout(ctx, null);

instead

blured=new BlurLayout(ctx);