DELETE/ SELECT * FROM Product WHERE code = typedValue AND userId = currentUser
I have this but this is like SELECT * FROM Product WHERE code = typedValue
ref = FirebaseDatabase.getInstance().getReference();
String currentUser = FirebaseAuth.getInstance().getCurrentUser().getUid();
query = ref.child("Product").orderByChild("code").equalTo(typedValue);
query.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if(snapshot.hasChildren()){
for(DataSnapshot codeSnapshot: snapshot.getChildren()){
codeSnapshot.getRef().removeValue();
}
Toast.makeText(AbcActivity.this, "Delete",Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(AbcActivity.this, "This product is not available",Toast.LENGTH_SHORT).show();
}
}