0

I want to retrieve subcollection documents from firebase firestore android and show it in recycler view but nothing is showing in recycler view I think have a problem in data retrieving

 var myarray=ArrayList<User>()
   rv=findViewById(R.id.idrecycler) as? RecyclerView
    notebookRef.addSnapshotListener { querySnapshot, firebaseFirestoreException ->
           for(uid in querySnapshot!!.documentChanges){
               uid.document.reference.collection("ProfileData")
                   .addSnapshotListener { querySnapshot2, firebaseFirestoreException ->
                   for(da in querySnapshot2!!){
                  val note = da.toObject(Note::class.java)
                       var title = note.title
                  var description = note.notes
                           var note2 = da.toObject(Note2::class.java)
                           var username = note2!!.username
                           myarray.add(User(username!!,str.child(currentuser),title!!,description!!))
                       }
              }
  }}

User.class

data class User(
    var username:String,
    var userphoto: StorageReference,
    var title:String,
    var notes:String
)

uid are UserUID da are id of some notes

Database Snapshot :

enter image description here

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

0 Answers0