How to get a list of all files in Cloud Storage in a Firebase app?

后端 未结 19 1014
傲寒
傲寒 2020-11-21 11:25

I\'m working on uploading images, everything works great, but I have 100 pictures and I would like to show all of them in my View, as I get the complete list of

19条回答
  •  别跟我提以往
    2020-11-21 12:05

    For Android the best pratice is to use FirebaseUI and Glide.

    You need to add that on your gradle/app in order to get the library. Note that it already has Glide on it!

    implementation 'com.firebaseui:firebase-ui-storage:4.1.0'
    

    And then in your code use

    // Reference to an image file in Cloud Storage
    StorageReference storageReference = FirebaseStorage.getInstance().getReference();
    
    // ImageView in your Activity
    ImageView imageView = findViewById(R.id.imageView);
    
    // Download directly from StorageReference using Glide
    // (See MyAppGlideModule for Loader registration)
    GlideApp.with(this /* context */)
            .load(storageReference)
            .into(imageView);
    

提交回复
热议问题