0
How do I save the Log Snippet. and in firebase? or instead of logging into a way to save to firebase?
in case this code takes the number of Childs in firebase and shows in log, I tried and could not get this result. If you can help me thank :)
mDatabaseLike.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot snap: dataSnapshot.getChildren()) {
Log.e(String.valueOf(snap.child(currentUserId).toString()),snap.getChildrenCount() + "");
}
if (mProcessLike) {
if (dataSnapshot.child(currentUserId).hasChild(mAuth.getCurrentUser().getUid())) {
mDatabaseLike.child(currentUserId).child(mAuth.getCurrentUser().getUid()).removeValue();
mProcessLike = false;
} else {
mDatabaseLike.child(currentUserId).child(mAuth.getCurrentUser().getUid()).setValue(mPost_key);
mProcessLike = false;
}
}
}
Which part of the log you want to save?
– viana
snap getChildrenCount() + ""
– Novato365
Have you tried the documentation? https://firebase.google.com/docs/database/server/save-data?hl=pt-br
– viana
Yes I’ve tried..
– Novato365
value reaches zero? Gives null pointer in dataSnapshot? Happens what?
– Mr_Anderson
edited the question...
– Novato365
I didn’t pay much attention...for me had to save the data in firebase, I didn’t pay attention that the data comes from firebase (stupid) so at the same time I don’t need to save anything just call in the direct textview.. type thus, mCurtidas.setText(dataSnapshot.getChildrenCount() + "");
– Novato365