Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getwidth() null pointer exception #5

Open
xubi15 opened this issue May 6, 2018 · 3 comments
Open

getwidth() null pointer exception #5

xubi15 opened this issue May 6, 2018 · 3 comments

Comments

@xubi15
Copy link

xubi15 commented May 6, 2018

Getting image from API and set as background ...

Caused by java.lang.NullPointerException
Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
arrow_right
com.vansuita.gaussianblur.GaussianBlur.scaleDown (GaussianBlur.java:101)

@wishie
Copy link

wishie commented Oct 12, 2018

I also get

Caused by java.lang.NullPointerException
Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference

But only on a real device. The code works fine in the emulator.

@akhilsoni06
Copy link

akhilsoni06 commented Apr 8, 2019

While adding the bitMap into imageView please use the below method :

//Download image frorm url and make it blurry.
GlideApp.with(getContext()).asBitmap().load(imageUrl).into(new BitmapImageViewTarget(ivAvatar) {
@OverRide
protected void setResource(Bitmap bitmap) {
if(bitmap!=null) {
GaussianBlur.with(getContext()).size(100).put(resource,ivAvatar);
}}});
it's working fine for me..please check for the bitmap null condition.

@tamara4m
Copy link

I get it too..

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
at com.vansuita.gaussianblur.GaussianBlur.scaleDown(GaussianBlur.java:101)

and this fix doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants