我想从firestore中获取数据,其中包括一个主题数组列表,并将这些数据放入数组适配器。
public Findtutorclass(String name, String education, String city,String Email, String subject, String profileImg) {
Name = name;
Education = education;
City = city;
Subject = subject;
this.profileImg = profileImg;
this.Email = Email;
}
db.collection("Tutor")
.get().addOnCompleteListener( new OnCompleteListener <QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if(task.isSuccessful()){
for(QueryDocumentSnapshot document : task.getResult()) {
Findtutorclass p = document.toObject(Findtutorclass.class);
pojoClassArrayList.add(p);
}
recyclerView.setHasFixedSize( true );
adapterlist = new FindtutorAdapterlist(Find_tutor.this,pojoClassArrayList);
recyclerView.setAdapter( adapterlist );
}else{
Toast.makeText( Find_tutor.this,"not success",Toast.LENGTH_SHORT ).show();
}
}
} ).addOnFailureListener( new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText( Find_tutor.this,e.getMessage(),Toast.LENGTH_SHORT ).show();
}
} );