I am trying to set Image from FIrebase to Imageview using Glide but it is showing Error
Task<Uri> riversRef = storageReference.child(user.getUid() + "/profile.jpg").getDownloadUrl()
.addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
if (uri == null) {
Toast.makeText(getApplicationContext(), "URI IS NULL", Toast.LENGTH_LONG).show();
}
Glide.with(getContext()).load(uri).centerCrop().into(imageView);
}
});
And the error is:
Process: com.root.firebase, PID: 3875 java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.app.Activity.isDestroyed()' on a null object reference at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:133) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:125) at com.bumptech.glide.Glide.with(Glide.java:641) at com.root.firebase.UploadActivity$2.onSuccess(UploadActivity.java:72) at com.root.firebase.UploadActivity$2.onSuccess(UploadActivity.java:65) at com.google.android.gms.tasks.zzj.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)