Skip to content

Instantly share code, notes, and snippets.

@griajobag
Last active May 16, 2018 14:43
Show Gist options
  • Save griajobag/dfec6e143a4d6240eaf9805435ce94e3 to your computer and use it in GitHub Desktop.
Save griajobag/dfec6e143a4d6240eaf9805435ce94e3 to your computer and use it in GitHub Desktop.
firestores
private void startInsertDataDocumentGeneratedSendiri() {
progressDialog.show();
WebsiteModel model = new WebsiteModel("Droid Newbie","androidbie.com","About Programming");
CollectionReference collectionReference = firebaseFirestore.collection("data");
collectionReference.add(model)
.addOnSuccessListener(new OnSuccessListener<DocumentReference>() {
@Override
public void onSuccess(DocumentReference documentReference) {
progressDialog.dismiss();
Toast.makeText(MainActivity.this, "Berhasil Insert Data", Toast.LENGTH_SHORT).show();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
progressDialog.dismiss();
Toast.makeText(MainActivity.this, "Gagal Insert Data", Toast.LENGTH_SHORT).show();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment