Closed karim-eg closed 1 year ago
Your decorView.findViewById(R.id.content) is null most likely
Your decorView.findViewById(R.id.content) is null most likely
But i've added the linear as you see in code findViewById(R.id.content)
i've tried the same source on another new app and it worked, i don't know why it doesn't work here
I don't see the full code, so I can't tell you why. But if it's null, it's not a library bug
I don't see the full code, so I can't tell you why. But if it's null, it's not a library bug
the code below is inside recyclerView Adapter:
float flt = 12f;
View decorView = getWindow().getDecorView();
ViewGroup rootView = (ViewGroup) decorView.findViewById(R.id.content);
Drawable windowBackground = decorView.getBackground();
blurView.setupWith(rootView, new RenderScriptBlur(MainActivity.this))
.setFrameClearDrawable(windowBackground)
.setBlurRadius(flt)
.setBlurAutoUpdate(true);
So is it null?
Attempt to invoke virtual method 'android.view.ViewTreeObserver android.view.ViewGroup.getViewTreeObserver()' on a null object reference
Yes, But Finally i've solved it after i used this condition:
if (rootView != null) {
rootView.getViewTreeObserver();
}
If that solves your issue, there's just something wrong with your setup. Why are you setting the direct parent of the BlurView as the root view? Why are you looking it up in the decorView?
If that solves your issue, there's just something wrong with your setup. Why are you setting the direct parent of the BpurView as the root view? Why are you looking it up in the decorView?
Yes, as I mentioned this code is inside Recycler View Adapter linked with custom view
This is same like Facebook posts but the post background is blurred instead of white color, this is the nearest example.
Hello, i am trying to display blur at recyclerview customview but it show me this Error:
Attempt to invoke virtual method 'android.view.ViewTreeObserver android.view.ViewGroup.getViewTreeObserver()' on a null object reference
here the code that i used:
The XML Code: