Advertisement
yogawahyuy

Hapus kegiatan

Sep 15th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.08 KB | None | 0 0
  1.  private void deletePet() {
  2.         // Only perform the delete if this is an existing pet.
  3.         if (mCurrentUri != null) {
  4.             // Call the ContentResolver to delete the pet at the given content URI.
  5.             // Pass in null for the selection and selection args because the mCurrentPetUri
  6.             // content URI already identifies the pet that we want.
  7.             int rowsDeleted = getContentResolver().delete(mCurrentUri, null, null);
  8.  
  9.             // Show a toast message depending on whether or not the delete was successful.
  10.             if (rowsDeleted == 0) {
  11.                 // If no rows were deleted, then there was an error with the delete.
  12.                 Toast.makeText(this, "Kegiatan Gagal dihapus",
  13.                         Toast.LENGTH_SHORT).show();
  14.             } else {
  15.                 // Otherwise, the delete was successful and we can display a toast.
  16.                 Toast.makeText(this, "Kegiatan Berhasil dihapus",
  17.                         Toast.LENGTH_SHORT).show();
  18.             }
  19.         }
  20.  
  21.         // Close the activity
  22.         finish();
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement