in PersistenceContentProviderSample/app/src/main/java/com/example/android/contentprovidersample/provider/SampleContentProvider.java [130:147]
public int delete(@NonNull Uri uri, @Nullable String selection,
@Nullable String[] selectionArgs) {
switch (MATCHER.match(uri)) {
case CODE_CHEESE_DIR:
throw new IllegalArgumentException("Invalid URI, cannot update without ID" + uri);
case CODE_CHEESE_ITEM:
final Context context = getContext();
if (context == null) {
return 0;
}
final int count = SampleDatabase.getInstance(context).cheese()
.deleteById(ContentUris.parseId(uri));
context.getContentResolver().notifyChange(uri, null);
return count;
default:
throw new IllegalArgumentException("Unknown URI: " + uri);
}
}