firestore reference
private val db = FirebaseFirestore.getInstance()
referencing the textview
val txt=findViewById<View>(R.id.email) as TextView
doc.getString("notice") gets all the data in the document name "notice "and the field name "notice"
db.collection("notice").document("notice").get() .addOnCompleteListener(this){task->
if (task.isSuccessful){ val doc=task.result val data=StringBuilder("") data.append(doc.getString("notice")) txt.text=data.toString() } }
No comments:
Post a Comment