DatabaseReference is needed:
private DatabaseReference mDatabase; // ... mDatabase = FirebaseDatabase.getInstance( ).getReference( ); |
setValue() to save data to a specified reference, replacing any existing data at that path.
For example, the code below inserts a node called “app_title” in JSON top level:
DatabaseReference mRef = mDatabase.getReference( "app_title" ); mRef.setValue( "Realtime Database" ); |
setValue() to:
String, Long, Double, Boolean, Map<String, Object>,List<Object>,