Doubt of Firebase

Asked

Viewed 79 times

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;


                    }
                }
            }

inserir a descrição da imagem aqui

So it’s in the log: inserir a descrição da imagem aqui

  • Which part of the log you want to save?

  • snap getChildrenCount() + ""

  • Have you tried the documentation? https://firebase.google.com/docs/database/server/save-data?hl=pt-br

  • Yes I’ve tried..

  • value reaches zero? Gives null pointer in dataSnapshot? Happens what?

  • edited the question...

  • 1

    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() + "");

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.