Remove Specific value From Firebase Database

前端 未结 5 1219
执念已碎
执念已碎 2020-12-07 04:54

I want to Delete Specific value from Firebase Database following is Database which i have stored

Now, I want to Delete Fol

5条回答
  •  北海茫月
    2020-12-07 05:32

    Well Thanks to all, After Modification with lots of answer and query.. This is what worked with me.

    mReference.child("demo").orderByChild("fname").equalTo("John").addChildEventListener(new ChildEventListener() {
            @Override
            public void onChildAdded(DataSnapshot dataSnapshot, String s) {
                mReference.child("demo").child(dataSnapshot.getKey()).setValue(null);
    
                //also work
                //dataSnapshot.getRef().setValue(null);  
            }
    
            @Override
            public void onChildChanged(DataSnapshot dataSnapshot, String s) {
    
            }
    
            @Override
            public void onChildRemoved(DataSnapshot dataSnapshot) {
    
            }
    
            @Override
            public void onChildMoved(DataSnapshot dataSnapshot, String s) {
    
            }
    
            @Override
            public void onCancelled(DatabaseError databaseError) {
    
            }
        });
    

提交回复
热议问题