Augusto Augusto - 2 months ago 22
Android Question

How do I download an image from Firebase Storage on Android?

I'm using Firebase Storage to store images. I can't download these on the Android. I want to download all images of folder but for now I want to download just one, because I don't know how to download all images as a list yet.
I'm trying this

public static final String TAG = "AtividadesFragment";
ImageView imageView;

public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_atividades,container,false);
imageView = (ImageView) v.findViewById(;
return v;

public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference ref = storage.getReference().child("ImagensExercicios/abdominal_1.bmp");

Glide.with(getActivity()).using(new FirebaseImageLoader()).load(ref).into(imageView);


xmlns:android="" android:layout_width="match_parent"

android:layout_height="wrap_content" />


But nothing happens.

enter image description here

Answer Source

I am using the following code to get jpg images from Firebase storage. To get bmp images, I think the difference will be in the parameter of File.createTempFile("Images","jpg") // or bmp. I hope that it will work for you too.

private Bitmap my_image;
StorageReference ref = storage.getReference().child("ImagensExercicios/abdominal_1.bmp");
try {
            final File localFile = File.createTempFile("Images", "bmp");
            storageRef.getFile(localFile).addOnSuccessListener(new OnSuccessListener< FileDownloadTask.TaskSnapshot >() {
                public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {
                    my_image = BitmapFactory.decodeFile(localFile.getAbsolutePath());
            }).addOnFailureListener(new OnFailureListener() {
                public void onFailure(@NonNull Exception e) {
                    Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_LONG).show();
        } catch (IOException e) {

One more note is that I am using this code inside an AsyncTask class to achieve asynchronous task behavior.