Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove child nodes in firebase android?

I have a number of child nodes in my firebase db and I want to delete only one child node.

Firebase firebase=new Firebase("..address..");  firebase.push().setValue(classObj); 

//here classObj is a class object which has a getter and setter for an integer id

Now that I have pushed multiple objects I want to delete only one based on the id in the classObj

like image 684
Akhil Avatar asked Mar 23 '16 18:03

Akhil


People also ask

How do I remove a child from Firebase?

The simplest way to delete data is to call remove() on a reference to the location of that data. You can also delete by specifying null as the value for another write operation such as set() or update() . You can use this technique with update() to delete multiple children in a single API call.

How do I remove a child event listener?

Calling removeEventListener() removes the listener from that location. It will stop firing events after it has completed them for data it's already received. If you're still getting calls to the listener, something else is going on that is unfortunately impossible to say from the code you shared.

How do I remove data from Firebase?

Sign in to Firebase, then open your project. , then select Project settings. In the Your apps card, select the app that you want to delete. Under the Your apps card, click Remove this app.


1 Answers

To remove data:

firebase.child(id).removeValue(); 

You might do well to have a look at the Firebase documentation for Android btw, which covers this and many more topics.

like image 89
Frank van Puffelen Avatar answered Oct 08 '22 20:10

Frank van Puffelen