Uttam Panchasara Uttam Panchasara - 1 year ago 159
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.

Answer Source

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) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download