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);
}
});
}