Created
October 12, 2017 00:16
-
-
Save kenny-io/2bd3d4619acb8f9177e42b1bb777b9e3 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 addNewContact(){ | |
save = findViewById(R.id.save); | |
name = findViewById(R.id.name); | |
email = findViewById(R.id.email); | |
phone = findViewById(R.id.phone); | |
String mName = name.getText().toString(); | |
String mEmail = email.getText().toString(); | |
String mPhone = phone.getText().toString(); | |
Map<String, Object>newContact = new HashMap<>(); | |
newContact.put(NAME_KEY, mName); | |
newContact.put(EMAIL_KEY, mEmail); | |
newContact.put(PHONE_KEY, mPhone); | |
db.collection("PhoneBook").document("Contacts").set(newContact) | |
.addOnSuccessListener(new OnSuccessListener<Void>() { | |
@Override | |
public void onSuccess(Void aVoid) { | |
Toast.makeText(MainActivity.this, "User Registered", | |
Toast.LENGTH_SHORT).show(); | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment