Last active
November 13, 2019 20:46
-
-
Save udacityandroid/266e8875e63b25d219f153ba72613ea9 to your computer and use it in GitHub Desktop.
Revisions
-
udacityandroid revised this gist
Oct 21, 2016 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,3 +16,4 @@ public int delete(Uri uri, String selection, String[] selectionArgs) { default: throw new IllegalArgumentException("Deletion is not supported for " + uri); } } -
udacityandroid created this gist
Sep 7, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ @Override public int delete(Uri uri, String selection, String[] selectionArgs) { // Get writeable database SQLiteDatabase database = mDbHelper.getWritableDatabase(); final int match = sUriMatcher.match(uri); switch (match) { case PETS: // Delete all rows that match the selection and selection args return database.delete(PetEntry.TABLE_NAME, selection, selectionArgs); case PET_ID: // Delete a single row given by the ID in the URI selection = PetEntry._ID + "=?"; selectionArgs = new String[] { String.valueOf(ContentUris.parseId(uri)) }; return database.delete(PetEntry.TABLE_NAME, selection, selectionArgs); default: throw new IllegalArgumentException("Deletion is not supported for " + uri); }