June 2018
Beginner to intermediate
394 pages
9h 2m
English
By using the updateChildren() method of the database reference class, we can write the HashMap data structure into Firebase Realtime Database. Let's create a HashMap and add different key-value pairs, each should be reflected in the Realtime Database:
// Write a message to the databasemDatabase = FirebaseDatabase.getInstance();mDbRef = mDatabase.getReference("Donor/Name");//Writing HashmapMap<String, Object> mHashmap = new HashMap<>();mHashmap.put("Name 1/title", "Ashok");mHashmap.put("Name 1/content", "Parinitha");mHashmap.put("Name 2/title", "Krishna");mHashmap.put("Name 2/content", "Sumuthra");mDbRef.updateChildren(mHashmap);
The following screenshot illustrates the HashMap writing in the Firebase ...
Read now
Unlock full access