If Statement Not Returning The Correct Elements On Retrieving Data From Firebase
I have some data in FirebaseDatabase which looks like this: app -child1 -uniqueId1 -pId1 -lId1 -uniqueId2 -pId2 -lId2 -uniqueId3 -pId3 -lId3
Solution 1:
The addListenerForSingleValueEvent for child 2 will always be called twice - once when you set it up and second when it has read all the data. So when it is called the first time, it ends up calling fMethod(fID, "")
which is where you are getting all IDs from Child 1 including 3 and 7. But next time when it calls it, it is doing fine as you describe it. So if you remove the "else"
condition from your child2 ValueEventListener
, I think it should work fine.
Let me know if I understood your question and answered it. If not, feel free to explain more details.
Post a Comment for "If Statement Not Returning The Correct Elements On Retrieving Data From Firebase"