我需要一些关于从firebase下载图像然后在UI上显示它的指导。我相信我能找到的正确下载文件,firebase注意到它已发送数据。我不能让我的生活得到它显示。任何帮助是极大的赞赏。
mAuth = FirebaseAuth.getInstance();
FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference jobRef = storage.getReferenceFromUrl("gs://********************.appspot.com/bd67a3b962538b24-0.jpg");
final File localFile = File.createTempFile("jobNumbers","png");
jobRef.getFile(localFile).addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
@Override
public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {
// Local temp file has been created
StorageReference temp = taskSnapshot.getStorage();
Bitmap img = BitmapFactory.decodeFile(temp.getPath());
ImageView iv = (ImageView) findViewById(R.id.imageView);
iv.setImageBitmap(img);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle any errors
}
});