Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void deletePet() {
- // Only perform the delete if this is an existing pet.
- if (mCurrentUri != null) {
- // Call the ContentResolver to delete the pet at the given content URI.
- // Pass in null for the selection and selection args because the mCurrentPetUri
- // content URI already identifies the pet that we want.
- int rowsDeleted = getContentResolver().delete(mCurrentUri, null, null);
- // Show a toast message depending on whether or not the delete was successful.
- if (rowsDeleted == 0) {
- // If no rows were deleted, then there was an error with the delete.
- Toast.makeText(this, "Kegiatan Gagal dihapus",
- Toast.LENGTH_SHORT).show();
- } else {
- // Otherwise, the delete was successful and we can display a toast.
- Toast.makeText(this, "Kegiatan Berhasil dihapus",
- Toast.LENGTH_SHORT).show();
- }
- }
- // Close the activity
- finish();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement