Created
May 16, 2018 15:39
-
-
Save griajobag/3f751b72408445214d11c6f08e4c186c to your computer and use it in GitHub Desktop.
firestores
This file contains hidden or 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 updateTheData() { | |
progressDialog.setMessage("Updating Data..."); | |
progressDialog.show(); | |
WebsiteModel model = new WebsiteModel("Droid Newbie (updated)", "androidbie.com (updated)", "About Programming (updated)", modelWebsite.get(0).getIdDocument()); | |
CollectionReference collectionReference = firebaseFirestore.collection("data"); | |
DocumentReference documentReference = collectionReference.document(modelWebsite.get(0).getIdDocument()); | |
documentReference.set(model) | |
.addOnSuccessListener(new OnSuccessListener<Void>() { | |
@Override | |
public void onSuccess(Void aVoid) { | |
progressDialog.dismiss(); | |
Toast.makeText(MainActivity.this, "Updating successfully", Toast.LENGTH_SHORT).show(); | |
} | |
}) | |
.addOnFailureListener(new OnFailureListener() { | |
@Override | |
public void onFailure(@NonNull Exception e) { | |
progressDialog.dismiss(); | |
Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show(); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment