Right now i am downloading the images from the firebase by its name..
storageRef.child(\"NAME OF your IMAGE\").getBytes(Long.MAX_VALUE).addOnSuccessListener
No, you cannot. What can you do inseatd is to create a new section in your Firebase database named imageNames
and every time you add an image to Firebase Storage, add to coresponding image name under this new node like this:
Firebase-root
|
--- imageNames
|
--- imageId1: ImaneName1
|
--- imageId2: ImaneName2
To get all those names, just attach a listener on this imageNames
node and get all those names from the dataSnapshot
object like this:
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
DatabaseReference imageNamesRef = rootRef.child("imageNames");
ValueEventListener eventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot ds : dataSnapshot.getChildren()) {
String imageName = ds.getValue(String.class);
Log.d("TAG", imageName);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {}
};
imageNamesRef.addListenerForSingleValueEvent(eventListener);