Failing to Read Nested Data From Firebase Database

后端 未结 2 1383
梦谈多话
梦谈多话 2021-02-04 22:12

I am sending "Appetizers and Snacks" which is in name key from one activity 1 to activity 2.

In activity 2,the data received is simply :

2条回答
  •  时光取名叫无心
    2021-02-04 22:40

        databaseReference = FirebaseDatabase.getInstance().getReference();
        val ref = database.child("All Categories").child("0").child("recipes")
        
       
        val valueEventListener = object : ValueEventListener {
        override fun onDataChange(dataSnapshot: DataSnapshot) {
             val recipes = dataSnapshot.getValue(Recipes::class.java) // recipes model reading
        }
    
        override fun onCancelled(databaseError: DatabaseError) {
            
        }
    }
    ref.addListenerForSingleValueEvent(valueEventListener)
    

提交回复
热议问题