Skip to content

Instantly share code, notes, and snippets.

@griajobag
Created May 16, 2018 15:46
Show Gist options
  • Save griajobag/97a6a8bafc5f1bc9b40d39be6bc36cfd to your computer and use it in GitHub Desktop.
Save griajobag/97a6a8bafc5f1bc9b40d39be6bc36cfd to your computer and use it in GitHub Desktop.
firestores
private void deleteData(){
progressDialog.setMessage("Deleting Data...");
progressDialog.show();
CollectionReference collectionReference = firebaseFirestore.collection("data");
DocumentReference documentReference = collectionReference.document(modelWebsite.get(0).getIdDocument());
documentReference.delete()
.addOnCompleteListener(task -> {
progressDialog.dismiss();
Toast.makeText(MainActivity.this, "Deleting successfulyy", 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