0

Please help my to get a value from Firestore

I have a Firestore database where "adminData" collection but only single value is essential. I will like to retrieve it from the firebase database and store it in string. I made a Data class Admin for getting values Can you please help me with the implementation in android studio using Kotlin?

 val db = FirebaseFirestore.getInstance()
        db.collection("adminData").get()
            .addOnCompleteListener { it ->
                if (it.isSuccessful) {
                    for (documentt in it.result!!) {
                        val users = documentt.toObject(Admin::class.java)
                         str2 = StringBuilder().apply {
                            append(users.payqiwi)
                        }.toString()

Why str2 is empty when return it?

picture of debugging

picture of debugging

0 Answers0