-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeleteCr.java
More file actions
19 lines (17 loc) · 974 Bytes
/
deleteCr.java
File metadata and controls
19 lines (17 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public void deleteCr ( final String studentId){
final DatabaseReference mRoot, mDatabase;
mRoot = FirebaseDatabase.getInstance().getReference().child("app");
mDatabase = mRoot.child("cr");
mRoot.child("users").child("students").child(studentId).child("tag").setValue("default").addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
mDatabase.child(studentId).removeValue().addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful())
Toast.makeText(getApplicationContext(), "CR deleted successfully", Toast.LENGTH_LONG).show();
}
});
}
});
}