Setting custom key when pushing new data to firebase database

后端 未结 10 605
野的像风
野的像风 2020-12-13 12:22

Well, I am new to Firebase and I want to have my own keys while pushing new data to database.

Problem:

FireBase.push().setValue(mapped_values);
         


        
10条回答
  •  佛祖请我去吃肉
    2020-12-13 12:55

    Simple and Fast

     Map taskMap = new HashMap<>();
           taskMap.put("Name", name.getText().toString());
           taskMap.put("km", km.getText().toString());
          // taskMap.put("age", "45");
           taskMap.put("Day", day.getText().toString());
           mDatabaseReference.push().setValue(taskMap);
    

提交回复
热议问题