I want to store previous data and the new data in the same child using realtime database in android studio but it store only the new data and deleting the previous data
Question posted in Android Studio
The official documentation can be found here.
The official documentation can be found here.
2
Answers
You cannot store new and previous data in a single child in firebase, as it overwrites the previous data.
Still you can create a child under its parent and update them.
In case you mean you don’t want to overwrite data:
using push() will always generate new key and then adds the your data to "categories"
while:
will always overwrite it ..
Hope this helps .. more about how to write to realtime-database here