Uttam Panchasara Uttam Panchasara - 29 days ago 10x
Android Question

Remove Specific value From Firebase Database

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

enter image description here

Now, I want to Delete Following Values

fname: "John"

lname: "wick"

enter image description here

Here, What i have try to delete specific value from Firebase..

DatabaseReference demo = mReference.child("demo").orderByValue().equalTo("John").getRef();

demo.addListenerForSingleValueEvent(new ValueEventListener() {
public void onDataChange(DataSnapshot dataSnapshot) {

public void onCancelled(DatabaseError databaseError) {


But this will delete all values from database...

: How to delete that specific value??? what i have to do for that

Any help will be appreciated.


Instead of using addListenerForSingleValueEventtry using addChildEventListener as below,

Query queryRef = mReference.child("demo").orderByChild("fname").equalTo("John");

queryRef.addChildEventListener(new ChildEventListener() {
    public void onChildAdded(DataSnapshot snapshot, String previousChild) {