Skip to content

Instantly share code, notes, and snippets.

@e-lin
Created June 26, 2019 07:45
Show Gist options
  • Save e-lin/faecedd5cb32f7430aea5a628cc50818 to your computer and use it in GitHub Desktop.
Save e-lin/faecedd5cb32f7430aea5a628cc50818 to your computer and use it in GitHub Desktop.
Fetch pic data from Firebase
private fun poplulateViews(picId: String) {
picReference = FirebaseFirestore.getInstance().collection("pics").document(picId)
picReference.get()
.addOnSuccessListener(this) { snap ->
if (snap.exists()) {
val ring = snap.toObject(Pic::class.java)
val ref = FirebaseStorage.getInstance().getReference(pic.imagePath!!)
Glide.with(this@AnswerPicActivity).load(ref).into(ivGuest)
}
}
.addOnFailureListener(this) { e ->
Log.e(TAG, "Cannot fetch pic $picId", e)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment