Retrieve all data from firestore a particular document database in android studio using kotlin.... - Joklinz-Tech

Latest

Home Of Tech news,jobs and android tutorials

Thursday, 8 February 2018

Retrieve all data from firestore a particular document database in android studio using kotlin....


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