Answers for "firebase copy child data to another"

0

firebase copy child data to another

public void moveFirebaseRecord(Firebase fromPath, final Firebase toPath)
    {
        fromPath.addListenerForSingleValueEvent(new ValueEventListener()
        {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot)
            {
                toPath.setValue(dataSnapshot.getValue(), new Firebase.CompletionListener()
                {
                    @Override
                    public void onComplete(FirebaseError firebaseError, Firebase firebase)
                    {
                        if (firebaseError != null)
                        {
                            Timber.d("moveFirebaseRecord() failed. firebaseError = %s", firebaseError);
                        }
                        else
                        {
                            Timber.d("moveFirebaseRecord() Great success!");
                        }
                    }
                });
            }

            @Override
            public void onCancelled(FirebaseError firebaseError)
            {
                Timber.d("moveFirebaseRecord() failed. firebaseError = %s", firebaseError);
            }
        });
    }
Posted by: Guest on November-27-2020

Code answers related to "firebase copy child data to another"

Browse Popular Code Answers by Language