I am using realtime database. In that multiple users will give same set of data like shown in Snapshot1. Whenever the same user submitting other set of data, it is updating the old record but I want to add as a new record like a single user can save multiple set of data like in Snapshot2.
My Code is:
Contribution cont = new Contribution(money, month, payment, date, tref, rem);
FirebaseDatabase.getInstance().getReference("Contribution")
.child(FirebaseAuth.getInstance().getCurrentUser().getUid())
.setValue(cont).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(ContributionDeclarationForm.this, "Successfully Submitted", Toast.LENGTH_LONG).show();
Intent intent = new Intent(ContributionDeclarationForm.this, DashboardActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(ContributionDeclarationForm.this, "Not Submitted", Toast.LENGTH_LONG).show();
}
});
Thanks in advance.
Snapshot1:

Snapshot2:

