来自firebase数据库的数据在回收站视图中不可见

问题描述 投票:-2回答:1

我想从存储中检索图像到recyclerview但它无法正常工作

mFirestore.collection("Users").whereEqualTo("special", s).get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
        @Override
        public void onComplete(@NonNull Task<QuerySnapshot> task) {
            if (task.isSuccessful()) {
                final SpecializedDoctorNameFragment S = new SpecializedDoctorNameFragment();
                final List<DoctorNameStructure> eventList = new ArrayList<>();
                for (final DocumentSnapshot doc : task.getResult()) {
                    String id = doc.getString("id");

                    final DoctorNameStructure e = new DoctorNameStructure();
                    e.setName(doc.getString("name"));
                    e.setAddress(doc.getString("address"));
                    e.setConsultancy(doc.getString("consultancyFees"));
                    e.setSpecialization(doc.getString("special"));

                    storageReference.child("images/" + id).getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
                        @Override
                        public void onSuccess(Uri uri) {
                            uploadImages();
                            e.setImage(uri.toString());
                            eventList.add(e);
                        }
                    });

                }
                NameAdapter recyclerViewAdapter = new NameAdapter(getContext(), eventList, mFirestore);
                recyclerName.setAdapter(recyclerViewAdapter);

            } 
        }
    });
android android-recyclerview firebase-storage urlretrieve
1个回答
0
投票

监听器在setAdapter之后执行。更改填充列表的逻辑。

© www.soinside.com 2019 - 2024. All rights reserved.