I'm trying to fetch images from firebase in recyclerview but the listview is empty and show nothing below

I'm working on docs manager app in android and i used firebase for storage I want to retrieve files from firebase in ListView but I got nothing once I run my app.

private void setupFirebaseStorageListener() {
    storageElements.clear();
    addElement(emptyElement);
    addElement(emptyElement.duplicate());
    // Showing refresh animation before making requests to firebase server
    swipeRefreshLayout.setRefreshing(true);

    fbHelper.getDatabaseReference().addChildEventListener(new ChildEventListener() {
        @Override
        public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {

            Toast.makeText(context, "Child added", Toast.LENGTH_SHORT).show();

            if (StorageElement.isFile(dataSnapshot)) {
                // the element is a file

                MyFile file = dataSnapshot.getValue(MyFile.class);
                if (file != null &&

                        StorageElement.retrieveFileByName(file.getFilename(), storageElements) == null ) {
                    Log.d(TAG, "Adding new file: " + file.getFilename());
                    Toast.makeText(context, file.getFilename().toString(), Toast.LENGTH_SHORT).show();
                    addElement(file);
                }
            }
            else {
                // the element is a directory
                Log.d(TAG, "Adding new folder..");
                MyDirectory dir = new MyDirectory(dataSnapshot.getKey());
                if (StorageElement.retrieveDirectoryByName(dir.getDirectoryName(), storageElements) == null) {
                    addElement(dir);
                }
            }
            swipeRefreshLayout.setRefreshing(false);
        }


Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation