1
I have an X bank that contains categories of companies and I want you to enter the data manually in Categories, send a copy to Allempresas.
I’m using this code but I’m not finding a way to just get the kids
private void copyRecord(DatabaseReference fromPath, final DatabaseReference toPath) {
ValueEventListener valueEventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
toPath.setValue(dataSnapshot.getValue()).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isComplete()) {
Log.d(TAG, "Success!");
} else {
Log.d(TAG, "Copy failed!");
}
}
});
}
@Override
public void onCancelled(DatabaseError databaseError) {}
};
fromPath.addListenerForSingleValueEvent(valueEventListener);
}
this function I will have to create for each company? or will copy all academy children, food etc?
– Harrison
Will copy all children from each category. This is the only function you will create.
– Rosário Pereira Fernandes
You’re the man! Thank you so much!
– Harrison