Getting Image from Firebase Storage using Glide

前端 未结 3 1722
渐次进展
渐次进展 2020-12-06 06:47

I am trying to load an image from Firebase Storage using Glide but I am getting an error .

package com.kanishq.wallpaper;
import android.os.Bundle;
import an         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 07:20

    Try this way:

    storageReference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() {
                        @Override
                        public void onSuccess(Uri uri) {
                            imageURL = uri.toString();
                            Glide.with(getApplicationContext()).load(imageURL).into(i1);
                        }
                    }).addOnFailureListener(new OnFailureListener() {
                        @Override
                        public void onFailure(@NonNull Exception exception) {
                            // Handle any errors
                        }
                    });
    

    So this way, you get a URL to the image in the storage and you load that URL into the glide

提交回复
热议问题