1
How to bring this fire list to the cel screen?
val store = Shop("Fique Linda", "Temos o melhor!", R.drawable.storefiquelinda)
val dataBase = FirebaseDatabase.getInstance()
val myRef = dataBase.getReference("mensagens")
myRef.child("fiqueLinda").child("1").setValue(store)
myRef.addValueEventListener(object : ValueEventListener {
override fun onDataChange(dataSnapshot: DataSnapshot?) {
val value = dataSnapshot!!.value as HashMap<*, *>
for (messageSnapshot in dataSnapshot.children) {
val name = messageSnapshot.child("fiqueLinda").value as String?
val age = messageSnapshot.child("age").value as Long?
//Desta forma eu estou pegando do firebase ou não?
list.add( Shop(storeFiqueLinda.name, storeFiqueLinda.subTitle!!, storeFiqueLinda.thumbnail!!))
}
//list.add( Shop(myRef.key, storeFiqueLinda.subTitle!!, storeFiqueLinda.thumbnail!!) )
Log.d("VALUE", "Value is: " + value)
}
override fun onCancelled(error: DatabaseError?) {
Log.w("", "Failed to read value.", error!!.toException())
}
})