I am trying to simply get some data I've created mannually in Firebird Realtime Database following the Firebase Assistant on Android Studio (it is an actual copy of the instructions):
override fun onMapReady(googleMap: GoogleMap) {
mMap = googleMap
val database = Firebase.database
val myRef = database.getReference("ChargePoint") //this is the only item I have edited, since it is from by database
// Read from the database
myRef.addValueEventListener(object: ValueEventListener() {
override fun onDataChange(snapshot: DataSnapshot) {
// This method is called once with the initial value and again
// whenever data at this location is updated.
val value = snapshot.getValue<String>()
Log.d("onDataChange", "Value is: " + value)
}
override fun onCancelled(error: DatabaseError) {
Log.w("onCancelled", "Failed to read value.", error.toException())
}
})
However, I am getting this from the line with ValueEventListener
:
This class does not have a constructor
Every single example I searched has a "new" clause whenever in Java or the "object:" reference directly in Kotlin. What am I missing? Thanks in advance.