Updating the data on Firebase Android

前端 未结 3 1673
借酒劲吻你
借酒劲吻你 2021-01-02 07:41

I want to update the date on Firebase on a specific node.

DB Structure:

I am trying as

private void updateData() {
database = FirebaseDa         


        
相关标签:
3条回答
  • 2021-01-02 08:24

    you can assign new value in same child,like

      Firebase firebase = new Firebase("your database link/myDb");
        firebase.child("awais@gmail.com").child("leftSpace").setValue("newValue");
    
    0 讨论(0)
  • 2021-01-02 08:28

    According to Firebase Official Documentation you can update the specific node of parent node in this way

    Using setValue() in this way overwrites data at the specified location, including any child nodes. However, you can still update a child without rewriting the entire object. If you want to allow users to update their profiles you could update the username as follows:

        FirebaseDatabase  database = FirebaseDatabase.getInstance();
        DatabaseReference mDatabaseRef = database.getReference();
    
        mDatabaseRef.child("TABLE_NAME").child("orderStatus").setValue(2);
    

    Note! TABLE_NAME mean your parent node whose child node you want to update.

    0 讨论(0)
  • 2021-01-02 08:33

    In Firebase To update specific value you can use it...

    ref.child("myDb").child("awais@gmailcom").child("leftSpace").setValue("YourDateHere");
    

    or you can move into child using "/" as follow :

    ref.child("myDb/awais@gmailcom/leftSpace").setValue("YourDateHere");
    
    0 讨论(0)
提交回复
热议问题