Skip to content Skip to sidebar Skip to footer

Firebase Transaction Returns ArrayList Handling

I'm trying to check if a child already has a value or not, if not then increment a child value and add an array of data inside the child. ex: and expect the code will add second c

Solution 1:

When you make this call:

String numQuestions = (String) mutableData.getValue();

You get the value of the MutableData object, which contains all data under mDatabase.child("history").child(user.getUid()) from your database. So that is way more data than a single string. My guess is that you're looking for:

String numQuestions = (String) mutableData.getKey();

Post a Comment for "Firebase Transaction Returns ArrayList Handling"