Created
October 11, 2017 23:51
-
-
Save kenny-io/2dc6dd1f1f60d05048f9e0a6c9c6fa45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void ReadSingleContact() { | |
DocumentReference user = db.collection("PhoneBook").document("Contacts"); | |
user.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() { | |
@Override | |
public void onComplete(@NonNull Task<DocumentSnapshot> task) { | |
if (task.isSuccessful()){ | |
DocumentSnapshot doc = task.getResult(); | |
StringBuilder fields = new StringBuilder(""); | |
fields.append("Name: ").append(doc.get("Name")); | |
fields.append("\nEmail: ").append(doc.get("Email")); | |
fields.append("\nPhone: ").append(doc.get("Phone")); | |
textDisplay.setText(fields.toString()); | |
} | |
} | |
}) | |
.addOnFailureListener(new OnFailureListener() { | |
@Override | |
public void onFailure(@NonNull Exception e) { | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment